Skip to content

Commit

Permalink
Merge pull request #54 from humanmade/backport-52-to-v8-branch
Browse files Browse the repository at this point in the history
[Backport v8-branch] Update GTM docs with trigger groups
  • Loading branch information
roborourke authored Nov 19, 2021
2 parents 40ea505 + a2fb2cf commit 8c98b8a
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 4 deletions.
Binary file modified docs/assets/gtm-tag.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/assets/gtm-trigger-group.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/assets/gtm-trigger.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
30 changes: 26 additions & 4 deletions docs/consent/google-tag-manager.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,25 +19,47 @@ To get started in GTM first navigate to Variables in the left hand sidebar and o

Triggers in GTM can be used to block the execution of certain tags by adding them as exceptions. We recommend this method to check if consent is missing before firing a given tag.

Due to the way GTM works it is required to create trigger groups to combine default triggers like "All pages" with triggers for changes to consent.

### Consent Trigger

You will need to create a trigger for each category of consent you need to check when firing tags. Navigate to the Triggers section on the left hand sidebar and then click "New".

- For the name enter **"Marketing Consent Missing"**
![Adding a Tag Manager trigger](../assets/gtm-trigger.png)

- For the name enter **"Has Marketing Consent"**
- replace **"Marketing"** with whichever category your trigger will be for
- For the trigger type choose **"Custom Event"**
- For the Event Name enter `altis-consent-changed`
- Select **"Some custom events"** for when the trigger should fire and options to create conditions will appear
- From the list of variables select your **"Cookie Consent Categories"** variable from earlier
- Select **"does not contain"** as the operator
- Select **"contains"** as the operator
- Enter **"marketing"** as the text the variable should contain
- again replace **"marketing"** with the category you are adding
- Save the trigger

**Note:** if you have 2 categories with similar text e.g. "statistics" and "statistics-anonymous" you can add a comma after the name to get an exact match, for example "statistics,"

![Adding a Tag Manager trigger](../assets/gtm-trigger.png)

Repeat the above steps for each consent category you need.

### Combined Trigger

Next you will need to create a trigger group combining the consent trigger and your desired primary trigger, most of the time this is the "All Pages" trigger.

![Adding a Tag Manager trigger group](../assets/gtm-trigger-group.png)

Again, navigate to the Triggers section on the left hand sidebar and then click "New".

- For the name enter **"All Pages - With Marketing Consent"**
- replace **"All Pages"** with your primary trigger name
- replace **"Marketing"** with whichever consent category trigger you are combining this with
- For the trigger type choose **"Trigger Group"**
- Under **"Triggers"** add a new trigger, select **"All Pages"**, or whichever primary trigger you wish
- Add another trigger, this time select the **"Has Marketing Consent"** trigger you created in the previous section
- Save the trigger

You will need to do this for each consent category & primary trigger event you need.

Once you are done you can start using these triggers to ensure only the tags that your website visitors have consented to are loaded by clicking "Add Exception" and selecting the trigger(s) that check the required consent categories.

![Adding a Tag Manager tag that checks consent categories](../assets/gtm-tag.png)

0 comments on commit 8c98b8a

Please sign in to comment.