Display Cookie Banner with a custom link

Nelson
Written by NelsonLast updated 19 days 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. 

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>

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>


Link to open cookie declaration tab

You can also make a link that opens the Cookie declaration tab instead of the banner to adjust settings with a JavaScript code: 

<a href="javascript:CookieScript.instance.showDetails()">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 article help you solve your issue?