secureprivacy.ai

Secure Privacy Support Center

Search for any help questions or topics.

HOW-TO: manually block cookies using Google Tag Manager

We assume that you have already created a GTM account, created a website container in GTM, and added container snippet to your website as required to continue
Avatar
Andrew Sidorkin
Updated 2 months ago

In this article, we assume that you have already created a GTM account, created a website container in GTM, and added the GTM container snippet to your website as required: https://support.google.com/tagmanager/answer/6103696.


We also assume that Secure Privacy is already installed. To know more about how to implement Secure Privacy with GTM, read this article.


Blocking with a single GTM event

To block cookies and trackers, you need to add triggers of the respective script tags on your GTM. Follow these steps to add triggers to your GTM.

  • From the GTM “Triggers” list, click “New”.

  • Choose “Custom Event” and enter an event name for the trigger.

  • Type sp-consent="PLUGIN NAME" in the field “Event name”. (The correct plugin/service name should be copied from your scan report page inside Secure Privacy account under the "Classification" tab)

If you are blocking Google Analytics, your configuration should look like this. We have named the trigger as SP-Consent-Google-Analytics

  • Enter: sp-consent="Google Analytics"

  • Click “Save” to create the trigger.

  • Repeat the above for each type of plugins, so you have all triggers created on your GTM.

  • Now that you have created your Trigger, you need to attach it to their respective Scripts.

Your Next steps will depend on the Plugin which you need to block. In this article, we are taking Google Analytics as an example.

  • Create the Universal Analytics tag by clicking “New” from the Tags list - or edit your existing Universal Analytics tag.

  • If creating a new tag, select “Universal Analytics” under the “Choose tag type” pane. Select “New Variable” in the select box under “Google Analytics Settings” and enter your GA Tracking ID (available from Google Analytics) in the field “Tracking ID”. Click “Save”.

  • As a trigger, select the trigger you have just created, “SP Consent-Google-Analytics”. Click “Save” to create or update the tag.

This is what your final Universal Analytics tag configuration should look like (except for your unique Tracking ID):

  • Finally, click “Publish” to push your changes live to your site.

Note: If you are using multiple triggers on a tag, then follow this article to enable cookie blocking.

While using Google Tag Manager, there can be Tags with multiple triggers. This article explains how we can block cookies with multiple Triggers.

 

Was this article helpful?
😞 😐 😃