Google Tag Manager Setup
Setup Google Tag Manager for webpages, by using the following steps from Google - or watch the video above.
Adding Google Tag Manager to Foundation Theme
The following applies to Foundation themes and for those looking to measure Google Analytics activity in the Vanilla KB.
You will have two snippets to add, that you are given by Google. Let's add them now to Vanilla!
Open Theme Editor - and click the edit button. Add the Javascript code to be placed in the <head>
in the Javascript tab,
Then add the <noscript> portion of the snippet to the Header of your Foundation theme
Of course making sure you have the right GTM code. Make sure to save.
Next head over to the Technical ->Security tab and ensure you allow Google Analytics traffic to be read. By adding the following in the Content Security Domains
*.googletagmanager.com
*.google-analytics.com
It should appear as so:
Now run debug on your Google Tag manager here to make sure things are working as needed.
Please note: Foundation must be the theme used for mobile theme, otherwise, mobile traffic will not be measured, unless this code is added to the mobile theme separately.
Adding Google Tag Manager Code to non-Foundation Theme
The following applies only to non-Foundation themes.
To add the code given to you, you will need to create two Pockets, with the Pockets Plugin.
The first Pocket will be for placing the Google Tag Manager code for the Head area.
Give the Pocket a memorable name and make sure the following:
- Paste Tag manager code from part one in Body
- Page selected is (All)
- Location is Head
- Repeat is set to Before
Click Save.
Let's move to the second Pocket we will need to create for the secondary Tag Manager code, required for the content area.
Give the Pocket a memorable name and make sure the following:
- Paste Tag manager code from part two in Body
- Page selected are (All)
- Location is Content
- Repeat is set to Before
Click Save.
Enable both Pockets, by toggling the button to the right.
You are now ready to add additional Google Analytics Tags as needed in your Google Tag Manager. Google has some handy documentation here.