How to install Cookie-Script with Google Tag Manager

How to install Cookie-Script with Google Tag Manager

You can easily install Cookie-Script via Google Tag Manager (GTM) by following these step-by-step instructions.

It is assumed that you have already had experience with GTM and your GTM account is created, also you created a website container in GTM and added the GTM container snippet to your website as required: https://support.google.com/tagmanager/answer/6103696.

Implementing the Cookie-Script popup box in GTM

In your GTM Workspace create a new tag by clicking New tag > Custom HTML Tag. In the HTML field, insert Cookie-Script code copied from your item. Code should look similar to the one below:

<!--Start Cookie Script--> 
<script type="text/javascript" charset="UTF-8"
src="http://chs03.cookie-script.com/s/xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx.js">
</script> <!--End Cookie Script-->

Next, click Add trigger choose DOM Ready and apply a name to your tag.

Your final tag configuration window should look like this. (unique number of .js file have been changed ):

cookie code

In the end, click "Publish" to apply your changes to your website.

Configuring Third-party Scripts in Google Tag Manager

After you have added Cookie-Script popup to your website you might need to configure some third-party scripts to be loaded only after user's consent. This is needed to block third-party cookies. Fortunately, Cookie-Script has a build-in integration with Google Tag Manager events which allows you to set all the triggers and tags in your GTM account. You can find detailed instructions in our manual for disabling third-party scripts using GTM