Display Cookie Banner with a custom link

Display Cookie Banner with a custom link

Nelson
Written by NelsonLast update 7 months ago

You can make a custom link or button that opens Cookie Banner when clicked. Custom links or buttons can be placed anywhere on the page. 

Link with ID attribute

You have to assign ID attribute or class csconsentlink  to any element, clicking which will open the Cookie Banner to adjust consent settings. It can be any element: button, link, image, etc. Some examples: 

<a href="javascript:void(0)" id="csconsentlink">Cookie Settings</a>
<a href="javascript:void(0)" class="csconsentlink">Cookie Settings</a>
<button id="csconsentlink">Cookie Settings</button>
<button class="csconsentlink">Cookie Settings</button>
<span id="csconsentlink">Cookie Settings</span>
<button class="csconsentlink">Cookie Settings</button>

Link with JavaScript code

You can also make a link that opens Cookie Banner to adjust settings with a JavaScript code: 

<a href="javascript:CookieScript.instance.show()">show popup</a>


Note: If the custom link does not work properly, you need to update the GTM template.

For more custom links to control visitor's consent, see the custom functions article.

Did this answer your question?