Google Tag Manager

Free!
Download
Description

Build Status License: MIT

Integrates Google Tag Manager (GTM) in Statamic 2. The GTM javascript is rendered via tags.

Installation

  1. Download the addon and rename the folder to GoogleTagManager
  2. Move the GoogleTagManager folder to site/addons

Configuration

The addon offers the following settings:

  • Container ID The ID assigned by GTM for this website container.
  • Data Layer The name of the data layer. Default value is dataLayer. In most cases, use the default.
  • Excluded paths Define paths where the GTM javascript should be omitted. You may use * as wildcard, e.g. /about* will exclude every page under /about.
  • Exclude for authenticated users Toggle to exclude GTM javascript for all authenticated users. If set to false, you might exclude for specific roles or groups.
  • Exclude for user roles Exclude GTM javascript for some user roles only, enter role names.
  • Exclude for user groups Exclude GTM javascript for some user groups only, enter group names.

Tags

Render the GTM javascript in your layout template with the provided tags:

  • Add the {{ google_tag_manager:head }} tag somewhere in your <head>.
  • Add the {{ google_tag_manager:body }} tag right after the opening <body> tag.

That's it! 🎉 Your website should now be connected to Google Tag Manager.

Testing

You might easily test if the GTM tags are firing:

  1. Log into the GTM container at tagmanager.google.com.
  2. Enable Preview mode.
  3. Visit your website within the same browser. You should now see the GTM debug console on the bottom of the page.

Use the GTM debug console to check if all tags are firing properly.

If you do not see the debug console, make sure that you visit your website as anonymous user, if you exclude the GTM javascript for authenticated users.


Important Links
Details
Released December 17, 2018
Updated 1 month ago
Version v1.0.0
Downloads 32
Requires Statamic 2

Stefan Wanzenried

More by Stefan Wanzenried

Similar Addons

See All
A tag, modifier and api to create mailto links with ease

MailtoLink

by Christopher Bischoff in Spam, Tag
A tag, modifier and api to create mailto links with ease
Easily embed social media posts and feeds right into your content.

Social Embeds

by Duncan McClean in Tag, Social Media
Easily embed social media posts and feeds right into your content.
A tag pair to turn those replicator and bard sets into friendly neighbors, able to retrieve the type (or other field) from the next or previous set. Hidey ho!

Neighbors

by Becky Soll in Tag
A tag pair to turn those replicator and bard sets into friendly neighbors, able to retrieve the type (or other field) from the next or previous set. Hidey ho!
Protect your Statamic forms using Google's reCAPTCHA service.

Google reCAPTCHA

by Aryeh Raber in Forms, Integration, Spam, Tag
Protect your Statamic forms using Google's reCAPTCHA service.