Mar 18, 2016

How To Track Events Using Google Tag Manager

Most websites have a number of different actions they’d like their site visitors to take – while their ultimate goal may be a sale, a secondary or mini-goal may be a newsletter sign up, a ‘click to call’, or a pdf download.

With Google Tag Manager, you can set up tags that will record your events automatically, so you don’t have to go and track each one individually. This is great for those sites that have lots of downloads or clicks that they want to record.

Google Tag Manager has been around for a couple of years now, and effectively, it’s a way of organising all the different tracking tools that you’ll have on your site, and reducing your page load time. Instead of including tracking for Facebook, DoubleClick, Google AdWords, Google Analytics, ecommerce, and more, you just include one small script in your page and it does the job for all of those trackers.

For now, though, we’ll focus on one of the most-used functions of Google Tag Manager – capturing events.

Basic Google Tag Manager Set Up

1. Go to https://www.google.com/tagmanager/web/ and login with your Google account.

2. Click “Create Account”

3. Enter your business name

4. Enter your site URL, and choose “Web”

Add a new account in GTM

5. Accept the Terms of Service

6. Follow the instructions for installing the script. This script goes immediately after the opening <body> tag on every page of your website. Ask your web developer for help if you don’t know what to do. You’ll also need to comment out/delete your old, standard Google Analytics code – Google Tag Manager code replaces it.

7. After you’ve installed your Tag Manager code, open up your standard Google Analytics account.

8. Find your site, open it, and click “Admin” from the top right.

Choose Admin to find your Tracking ID

9. In the middle column, called Property, click “Property Settings”. This will display your Tracking ID which is needed for most tags.

10. Back in Google Tag Manager, you’ll create your first, essential tag. This one makes sure that Google Analytics keeps recording its data. Choose “New Tag”

11. Call it “Page Tracking”.

12. Under Choose Product, select “Google Analytics”

13. Under Choose a Tag Type, select “Universal Analytics” (you should be using this – otherwise, upgrade your Analytics)

14. Under Configure Tag > Tracking ID, copy and paste your Tracking ID from Google Analytics into this field.

15. Check the “Enable Display Advertising Features” box.

16. Leave Track Type as “Page View”. Click “Continue”.

17. Under Fire On, select “All Pages”. Click “Create Tag”.

Create a standard page tracking tag in GTM

This creates a tag that will record Google Analytics data for your site.

The next tag is the events tag. We’ll create two events for now – one for PDF downloads, and one for outbound clicks (links off to other sites).

 

How to Add Variables

First, you’ll need to add some extra variables. Luckily, Google Tag Manager has most of the ones you’ll need already built in – you just need to turn them on.

1. Go to Variables on the left hand side.

2. Click all the checkboxes under Clicks and Forms.

GTM In-built Variables

 

How to Create PDF Event Tracking Tag

1. Under Tags, click “New”.

2. Call the tag PDF Downloads.

3. Under Choose Product, select “Google Analytics”.

4. Under Choose a Tag Type, select “Universal Analytics”. Click “Continue”.

5. Configure Tag, enter the same tracking ID from Google Analytics as earlier. Leave “Enable Display Advertising Features” unchecked.

6. From the Track Type drop down box, select “Event”.

7. Fill out the Event Tracking Parameters as follows:

  • Category: PDFs
  • Action: Downloads
  • {{Click URL}}

Leave all other settings as default. Click “Continue”.

8. Under Fire On, select “Click”. It will show a Create Trigger dialog box.

9. Call your trigger PDF Downloads.

10. Leave Choose Event and Configure Trigger settings as default. Click “Continue”.

11. Under Fire On, choose “Some Clicks”.

12. Select from the drop down boxes “Click URL”, then “contains”, then type in “.pdf” (without quotation marks).

13. Click Create Trigger.

Create a PDF download trigger in GTM

This will return you to the tag itself.

14. Click the blue “Create Tag” button down the bottom.

And that’s it!

Now we move on to tracking outbound clicks.

 

How to Create Outbound Clicks Tag

1. Under Tags, click “New”.

2. Call the tag Outbound Clicks.

3. Under Choose Product, select “Google Analytics”.

4. Under Choose a Tag Type, select “Universal Analytics”. Click “Continue”.

5. Configure Tag, enter the same tracking ID from Google Analytics as earlier. Leave “Enable Display Advertising Features” unchecked.

6. From the Track Type drop down box, select “Event”.

7. Fill out the Event Tracking Parameters as follows:

  • Category: Outbound Clicks
  • Action: Link
  • {{Click URL}}

Leave all other settings as default. Click “Continue”.

8. Under Fire On, select “Click”. Click “New” to create a new trigger.

9. Call your trigger Outbound Clicks.

10. Leave Choose Event and Configure Trigger settings as default. Click “Continue”.

11. Under Fire On, choose “Some Clicks”.

12. Select from the drop down boxes “Click URL”, then “does not contain”, then type in your site’s domain name – that is, the home address for your site, without any www or http or slashes, e.g. “bwired.com.au”, “mybusiness.com.au” (without quotation marks).

13. Click “Create Trigger”.

Create an outbound clicks trigger in GTM

This will return you to the tag itself.

14. Click the blue “Create Tag” button down the bottom.

Create an Outbound Click Tag in Google Tag Manager

Finally, we need to test and publish.

 

How to Test and Publish Google Tag Manager

1. From the top right of Google Tag Manager, select Preview from the red drop down box.

2. Within the same browser, visit your site and try out one of your events (e.g. an outbound click or a pdf download).

3. Log into Google Analytics, and click on “Real-Time” from the left hand menu, then click “Events”.

4. Click over to Events (Last 30 min) and you should be able to see the event that you’ve just clicked on.

See the events in Real Time

5. Go back to Google Tag Manager, click “Leave Preview Mode”, and click “Publish” from the top right. And that’s it!

Go back to Google Tag Manager, click ?Leave Preview Mode?

Leave a comment