Tutorials › How to set up Google Tag Manager
How to set up Google Tag Manager
Overview
Steps for setting up Google Tag Manager with Google Analytics in WordPress.
Create your Google Analytics account before following these steps.
Steps
I. Create your Google Tag Manager account
- Login to Google Tag Manager: https://tagmanager.google.com/
- Click Create Account
- Enter the name of your business or brand, e.g. “WP Sofia”
- Select the country your business is located in
- Enter the URL of your website in Container name, e.g. “wpsofia.com”
- Select Web as the Target platform
- Click Create
- Accept the Terms of Service Agreement
II. Set up the Google Analytics variable
- Click Variables from inside your Google Tag Manager account
- Click New next to User-Defined Variables
- Enter GA Settings as the variable name
- Click Variable Configuration
- Select Google Analytics Settings
- Enter your Google Analytics Tracking ID
- Click Save
III. Set up the Google Analytics tag
- Click Tags
- Click New
- Enter Universal Analytics as the tag name
- Click Tag Configuration
- Select Google Analytics: Universal Analytics
- Select Page View as the Track Type
- Select GA Settings as your Google Analytics Settings variable
- Click Triggering
- Select All Pages
- Click Save
IV. Publish your GTM workspace changes
- Click Submit in the top right-hand corner
- Enter Added Universal Analytics as the Version Name
- Click Publish
V. Add Google Tag Manager to WordPress
- Click the tag ID in the top bar of your GTM account
- Copy the head code
- Open your WordPress website
- Click Customise
- Click Code
- Click Head Code
- Paste your GTM head code
- Copy the body code from your GTM account
- Click the back arrow in WordPress customiser
- Click Header Code
- Paste the body code
- Click Publish
The last and final step is to test that your tag is working by opening Google Analytics and checking to see if you show up as a visitor under the Realtime overview.
Additional notes
Set up additional Google Tag Manager environments to match your development or staging website environments.
Avoid “double-tagging”. If you have already set up Google Analytics then remove that code before adding your Google Tag Manager code. Otherwise you may end up duplicating your analytics data.