Google Tag Manager: Tracking Important Activity on Your Website


Want to sell more using social media or content marketing? PRISM is our magic formula

Yes, I want my free awesome guide on PRISM now!

Google Tag Manager: How to track Important Activity on Your Website

Google Tag ManagerHow many people are clicking on the ads on your website? How many times do people click on the links to external websites?

How many people download your pdf guide on your site?

Up until now if you wanted to track these type of events in Google analytics you had to start adding code on your page.

But now Google have made changes to Google Tag Manager which allows you track these events in Google analytics without any knowledge of code.

In this article we’ll explain how to set it up.

Warning:  It’s a little complex to set up but can be extremely valuable.  If you don’t have the technical skill you may have to call in the geek!!

Step 1: Setting up the Google Tag Manager

When you initially sign up for Google Tag Manager you will be given a piece of code that you’ll have to copy to your pages on your website.    You can’t do anything with the tag manager until you copy this code in.

You then need to set create an account.  For the account you can just use your company name.

Every account can have one more more ‘containers’.  A container is just a way of grouping different types of tags.

A good way of setting this up is to have one container for each website and use the name of your website as the container name.


Google Tag Manager Container
Create a container for a website


Step 2: Setting up an event to track

Imagine you had an advertisement on your blog and you wanted to see how many people clicked on this ad. You could then compare the amount of visitors to clicks to see how well your ad is performing.

On our home page we have an image for the Social Media Examiner Conference which we’re speaking at so it would be good to track if people are actually clicking on it.


SM Examiner Image
We want to track if someone clicks on this


You need to set up 2 tags for this.  The first tag is telling Google tag manager to start listening for clicks on the website.  The second tag you set up is to track the clicks on this particular button and then record these clicks in Google analytics.

Here’s how you set it up.

1.  Tag 1 – Listening for the clicks!

Create a new tag which just specifies that the Tag manager will start recording all clicks.

Tag name:  Give it a name that reflects what the tag is for

Tag type: select Link click listener.


Click Listener
Create a tag to listen for clicks


Now you need to set up a rule specifying when this tag is fired.  Select the option ‘Add Rule to Fire Tag’.

You’ll need to give this a rule name and set up the conditions for the rule.

For this example I want to fire this rule for every page on the website.  Google tag manager supports wildcards (also known as regular expressions) so I can use an asterisk to match all pages on the website.

In the image below there are 3 examples listed of  other types of filters you can set.


Google Tag Manager Matching Rule
Specify how the rules are matched


When you set up the rule this is how it looks like.  RegEx just means regular expression (i.e. the wild card).


Tag Rules
Specify what web addresses are relevant before this tag is triggered


step 2 – Create a Google analytics event

Now that you have set up a tag to watch for clicks now you need to set up a tag that focusses in on clicks on the button/image on your website.

You also need to link this to Google analytics so that events will be displayed within your Google analytics reports.

Create a new tag.  Enter the name and specify the tag type as ‘Google analytics’.

In the Web Property ID you’ll need to specify the User Id which is associated with your Google analytics account.  This is available within the admin part of Google analytics.


Google Analytics Tag
Set up the Google analytics tag to track the link clicks in Google analytics


Select ‘event’ as the track type.

To track these links you add various parameters onto the link. For this we are going to add a category and an action. The category is a way of grouping different types of events and the action is generally the action that is taken with this event.

Now you need to specify a rule to fire this tag.  The rule is if the ad is clicked but this is only possible to specify if the ad is given an ‘id’.  This is a development task but you may have an id already.  Our Ad id is ‘smeclick’.  If your box doesn’t have an id your developer will need to add one (view source code on the page and search for id=)

So the rule set up will fire when the element id is ‘smeclick’ is clicked.


Ad Click rule
Specify the rule which identifies a click on the ad


You also need to set up a second rule.  When we set up a rule to listen for clicks this is recorded as ‘gtmclick’.  So we need to specify a rule so that the rule fires when we find out it’s a click.


Set up the rule that fires when we recognize it’s a click


Now that this is set up  we need to ‘create a version’.  This is just saving all the rules and automatically giving it a version name.


create version google tag manager
Save a version of your rules


Once you have a version set up now you can test out these rules before you publish.


preview and debug
You can test it out before you make it live


Once you are happy with it you can then publish it.

You see, I told you it was a bit technical.  I think Google could simplify this process a lot!!


So what would I do if I wanted to track a PDF download?

Instead of setting up a rule for listening for clicks you would set up a rule for clicks on links only (i.e. Link Click Listener)


Monitor Clicks
You only want to monitor clicks on links


You would then set up another tag and for the rules monitor the event which contains ‘gtm.linkclick’ and specify a url match which contains pdf.


You only want to match clicks on links which contain pdf
You only want to match clicks on links which contain pdf



There are some events you may want to track in Google analytics but is not possible.  Google Tag Manager allows you to expand what you can track.

It’s a bit technical to set up but you may really need it!

What do you think?

How could you use it?


293 Total Shares