How to restrict HTML code according to cookie settings

Modified on Fri, 1 Dec, 2023 at 9:40 AM

In this guide, you will learn how to modify the HTML codes that you have inserted on your website. This will ensure they either run (or don’t) based on when certain types of cookies are enabled.

Modifying the code can be useful if you have a widget embedded in the project (via HTML code) that collects cookies. When you insert the modified code, the widget won’t start and will not collect cookies. This procedure also applies to HTML codes that you have inserted in the page header. 


Example of how the code works: On your website, you have inserted a widget through a modified code that collects functional cookies. A visitor who does not allow the collection of functional cookies will come to your website, so the widget will not be displayed (the code does not run).


The code to be restricted must be defined by one of the following tags:

Marketing cookies: 

{IF_ACCEPTED_MARKETING_COOKIES} 

HTML code 

{/IF_ACCEPTED_MARKETING_COOKIES}

Functional cookies: 

{IF_ACCEPTED_FUNCTIONAL_COOKIES} 

HTML code 

{/IF_ACCEPTED_FUNCTIONAL_COOKIES}
  

Performance cookies: 

{IF_ACCEPTED_PERFORMANCE_COOKIES} 

HTML code 

{/IF_ACCEPTED_PERFORMANCE_COOKIES}

Code example: 

{IF_ACCEPTED_MARKETING_COOKIES}  

<p> This text/widget will appear <b> only </b> if <b> MARKETING COOKIES are accepted </b></p>  

{/IF_ACCEPTED_MARKETING_COOKIES} 


Was this article helpful?

That’s Great!

Thank you for your feedback

Sorry! We couldn't be helpful

Thank you for your feedback

Let us know how can we improve this article!

Select at least one of the reasons
CAPTCHA verification is required.

Feedback sent

We appreciate your effort and will try to fix the article