Need to track everything on your site without constantly editing site code? Google Tag Manager is your dream come true. Here’s how it works –
If you are using WordPress you’ll need this plugin (including in depth installation details)
Step 1. Open GTM (Google Tag Manager) account & Place Code
- Go to https://tagmanager.google.com
- Enter the name of your new account > continue
- Name your container (name it the website url) > select “web” > create
- Accept Google’s policy
- Next it will show you your tracking code
- Copy and paste this code immediately after the opening <body> tag on every page of your website
- if you use WordPress, use the plugin mentioned above to insert the code on all your webpages
Step 2. Set up tracking
- Click variables (left hand column)
- In the “clicks” box, check “click URL” and “click text”
- (You can also check any other boxes if you want to use to track actions. Click URL and Click Text are the more useful options that are unchecked by default)
- Click tags (left hand column)
- Select “New”
- Click “untitled tag” to name your tag. Examples:
- GA – Pageview – website.com/form-fill-success
- GA – Click – Form Submit Button
- Choose the analytics product you are using (I’ll show you how to set up a Google Analytics tag)
- Select “universal analytics”
- Enter your GA tracking ID
- Check “enable display advertising features” to enable remarketing & demographics data.
- Select the track type from the dropdown
- Pageview is simple & easy
- Events are used to track button clicks & more.
- Name your event category, action, & label. (you don’t need to enter anything into “value”) Example naming:
- Category = button, action = click, label = submit form button
- Click continue
- Select the type of event you want to track – “some pages” and “click” are simple and the most useful.
- Now you will set up the trigger – or what event(s) will make your tracking code fire.
- To track page view conversions select “all pages”
- Analytics will show you all page views & you can create goals that will count specific page views as conversions
- To track button clicks select “click”
- The “create trigger” box pops up
- Click “untitled trigger” to name you trigger. Example:
- Call Button Click
- Select “click”
- Select “just links” from the dropdown under Configure Trigger
- Uncheck the boxes & click continue
- You probably want to track specific clicks, so choose “some clicks”
- You can now specify the conditions when your tag will fire. Using click text (the text in your link/button), click url (the button link), or page url in combination will help you specify the button & page that will fire your tag.
- Now you have your Tag & Trigger set up
- Click “Publish” in the top right to push your changes live.
If you ever need the GTM code again, click on the blue link in the top left (below the Tag Manager logo). It will bring up a box with the tracking code for the container you are currently viewing (your current container name displays to the left of the blue link you just clicked).
To edit triggers afterwards, click triggers in the left sidebar and click the trigger you want to edit. This will bring up the configure box you used before while creating the tag & trigger.