How to Restrict HTML Code According to Cookie Settings
Info: This article applies to Website Builder purchases made after 14th January 2025. For further assistance, please contact our support team.
In this article, you will learn how to modify the HTML code on your website to control when certain elements are activated based on the cookies that are enabled.
This modification is useful if you’ve embedded a widget (via HTML code) that collects cookies. By adjusting the code, you can prevent the widget from running and collecting cookies unless specific cookie consent is given. This applies to both widgets embedded in the page content and HTML code inserted in the page header.
For example, if you’ve embedded a widget that collects functional cookies, and a visitor doesn’t allow functional cookies, the widget won’t display (the code won’t run).
To restrict the code based on the type of cookie, use 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}
If you have any further questions, simply raise a support request from within your Online Control Panel or call us on 01 5255768. Our Support team are here to help and ready to assist you with your enquiry.
For assistance raising a support request please follow the following guide.