Skip to main content
All CollectionsCookie Banner
How to configure cookies placed via Google Tag Manager?
How to configure cookies placed via Google Tag Manager?
Alex Franch Tapia avatar
Written by Alex Franch Tapia
Updated over a month ago

Video walkthrough

Background

In order to follow this documentation, we assume you have:

  • Created a Google Tag Manager container on your website.

  • Added the Google Tag Manager script to your website.

  • Added your Privasee Cookie Banner script to your website. Learn how to do this here.

Google Consent Mode Disclaimer

⚠️ Note that if you’re looking to add Google Analytics, Google Ads, Floodlight or Conversion Linker and receive traffic from the UK & EEA you need Google Consent mode. You can learn more about Google Consent Mode here and how to implement it here.

Google Tag Manager Background Information

  • Google Tag Manager helps you configure when the Javascript tags on your website are activated.

  • Each tag needs to have at least one trigger.

  • Triggers listen for certain website events (e.g. the website is fully loaded). Once this event takes place the trigger determines if the tag is activated.

  • Triggers can be firing or exception triggers:

    • Exception triggers determine when a tag is NOT fired and take precedence over other triggers.

  • Firing triggers determine when a tag is fired (we will use these).

  • Triggers can be use variables. A tag will be fired or blocked depending if a condition of a variable is met or not.

  • Privasee uses a special type of variable, a data layer variable, to communicate between your Google Tag Manager settings and your Cookie Banner.

1. Configuring Tools and Third Parties

We will use LinkedIn Insight as an example. However, you must follow this process for each Tool and Third Party that is placing cookies on your website and configured using Google Tag Manager.

⚠️ For tools which are placed directly as code snippets on your website and not added via Google Tag Manager, follow this guide instead.

2. Add the Tag

  1. Navigate to "Tags" in the side-menu and then click on "New".

  2. Add a new tag of type "LinkedIn Insight".

  3. Name it "Linkedin Insight Tag".

  4. Add your Insight Tag Id or the relevant id.

  5. Go to Advanced Settings and choose “Once per page” under the Tag firing options.

    ⚠️ If you want a certain tag to fire more than once per page view, you should set the tag firing option to "Unlimited". "Once per page", is our recommended setup.

  6. Press Save on the top right. No need to add a trigger yet.

3. Create a Variable

  1. Go to Variables in the side-menu and then New.

  2. Add a new variable of type Data Layer Variable.

  3. In the top left, name the variable “LinkedIn Insight Tag Variable”.

  4. Under Data Layer Variable Name, insert "LinkedIn Insight Tag".

    ⚠️ It’s important that the Data Layer Variable Name field matches the Tool or Third Party name on your Cookie Banner exactly.

    If your cookie banner shows “LinkedIn Insight Tag” but you write “Google Analytics 4” in the Data Layer Variable Name, it won’t work.

  5. Set Default Value to false

  6. Press Save

4. Create a Trigger

  1. Navigate to Triggers in the side-menu and click on New.

  2. Add a new trigger of type Custom Event.

  3. In the top left, name the trigger LinkedIn Insight Tag Trigger.

  4. Tick Use regex matching next to the Event name input field

  5. Under Event Name, insert (consent_status.*).

    ⚠️ Correct spelling, hyphenation and capitalisation are mandatory for this field.

  6. Tick Some Custom Events.

  7. In the drop-down menus, set the following condition: LinkedIn Insight Tag Variable contains true.

    Explanation: The variable contains the user's consent information. If the variable is true, then that means that the user opted in. If it’s false, it means they’ve opted out a specific tool. The trigger should only be fired (and tag therefore activated), if the variable=true. This information will be sent by the Cookie Banner

  8. Press Save

  9. Navigate to the “LinkedIn Insight Tag” and connect it to the trigger we just created.

5. Testing in Preview Mode & Submit

To make sure your Google Tag Manager setup works, you can test it in preview mode and then remember to set it Submit it to set it live.

  • Activate preview mode by clicking on "Preview" in the top-right corner.

  • Visit your website (assuming you’ve already added your cookie banner to your website)

  • Open the development tools of your browser and navigate to the "Network" tab.

  • Network requests of the implemented Tools and Third Parties should not be visible, unless they are categorised as Essential in the Privasee platform, until they accept for the Tool and Third Party to place cookies or press Accept All on the cookie banner.

Did this answer your question?