Tutorials › How to set up Google Tag Manager

How to set up Google Tag Manager

Updated 4 years ago

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

  1. Login to Google Tag Manager: https://tagmanager.google.com/
  2. Click Create Account
  3. Enter the name of your business or brand, e.g. “WP Sofia”
  4. Select the country your business is located in
  5. Enter the URL of your website in Container name, e.g. “wpsofia.com”
  6. Select Web as the Target platform
  7. Click Create
  8. Accept the Terms of Service Agreement

II. Set up the Google Analytics variable

  1. Click Variables from inside your Google Tag Manager account
  2. Click New next to User-Defined Variables
  3. Enter GA Settings as the variable name
  4. Click Variable Configuration
  5. Select Google Analytics Settings
  6. Enter your Google Analytics Tracking ID
  7. Click Save

III. Set up the Google Analytics tag

  1. Click Tags
  2. Click New
  3. Enter Universal Analytics as the tag name
  4. Click Tag Configuration
  5. Select Google Analytics: Universal Analytics
  6. Select Page View as the Track Type
  7. Select GA Settings as your Google Analytics Settings variable
  8. Click Triggering
  9. Select All Pages
  10. Click Save

IV. Publish your GTM workspace changes

  1. Click Submit in the top right-hand corner
  2. Enter Added Universal Analytics as the Version Name
  3. Click Publish

V. Add Google Tag Manager to WordPress

  1. Click the tag ID in the top bar of your GTM account
  2. Copy the head code
  3. Open your WordPress website
  4. Click Customise
  5. Click Code
  6. Click Head Code
  7. Paste your GTM head code
  8. Copy the body code from your GTM account
  9. Click the back arrow in WordPress customiser
  10. Click Header Code
  11. Paste the body code
  12. 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.