Updated: 2018/09/27 for compatibility with GTM4WP version 1.9
If you’re using WordPress, and want it measured with Google Analytics, I can heartily recommend the gtm4wp plugin. It’s free, it’s quality, and it’s very complete.
But.. after installing the plugin, and configuring it, you still have to configure your GTM container to use all the triggers and variables. That can be quite time consuming.
Until now. I’ve done the work for you and made a container you can import into your GTM workspace.
Full gtm4wp container Download
Download it from Github here – and if you find any issues, let me know.
Here’s how it works if you start from an empty container with no Google Analytics tags:
- Import the container into your workspace – and merge it. All tags come in one folder, neatly organised
- Go to the variables section and find the Google Analytics variable, and configure it to suit your needs
- change the UA variable (obviously) and other tracking properties (like ecommerce tracking)
- add any custom dimensions you want to track, using the correct CD numbers
- Preview, test, publish, audit, etc.
- Go outside and take a walk, enjoy the hour you saved.
If you’re starting from an existing container with Google Analytics tags already in place, consider:
- disabling the “Page View Tag” – you don’t want to track two pageviews per pageview.
- editing the 4 event tags to use your own GA config variable
What’s in the container?
The following gtm4wp dataLayer variables are configured:
(I’ve kept the names the same as they appear in gtm4wp, so making it easy for you to know what’s what)
- page/post variables
- Site variables (multisite)
- Reading – time to Scroll
- Site Search
- visitor info
- visitorEmail – use with caution, PII. Avoid sending this to Google Analytics
- visitor do not track
- Contact Form 7 ID
- Contact Form 7 inputs
- Generic Form variables (for enter/leave triggers)
- video playback variables
- Adwords Tag Parameters (google_tag_params)
- Browser / OS / Device info
The following triggers are configured:
- video triggers
- Media Player ready
- Media Player State Change
- Reading / Scrolling
- Article loaded
- Content Bottom
- Page Bottom
- Start Reading
- Contact Form 7
- Form Element triggers
- element enter
- element leave
- User logged in
- User registered
And finally, the Google Analytics Tags are set up as well – but you can use the above for adding other measure tools, obviously.
- Page View Tag – All Pages (please be careful if you already have one in place)
- 3 Reading events for:
- content bottom
- page bottom
- reading start
- Video event (for all video events)
- Form element enter / leave Event
- Ecommerce Events (all of them)
There’s really loads of variables that get filled (or not, depending on your gtm4wp options). Only a few are used in tags. It’s up to you how you go about adding the variables in Page Groups, Custom Dimensions, Custom Metrics, etc. Go wild! And be careful of analysis paralysis 🙂
To Tomas Geiger for creating the GTM plugin. Awesome timesaver, and free as well. Also, a big thanks to the #measure community for being generous in sharing loads of knowledge, work and donating so much free time to make our lives easier.Using the Google Tag Manager for WordPress plugin? Download a feature-complete container here. Click To Tweet