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

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.

 

gtmclick

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

 

Summary

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?

 




 

About the author

Ian Cleary

Author: Ian Cleary is the Founder of RazorSocial and is super passionate about helping people leverage tools and technology to improve effectiveness of your social media presence.

  • http://www.eservices-india.com/ eservicesindia

    where the report will be obtained !

  • Gloria

    Just what I think was about to begin to try and dig in to search for… (._. ) Now to figure out who to choose first…
    Thank you sooo much!

    • http://www.razorsocial.com/ Ian Cleary

      You’re welcome Gloria!

  • http://www.hisocial.com/ Hisocial

    Hey Ian, thanks for posting this article, I see you’ve shared some great tips on how to use this feature. It can really help a lot with tracking the behavior of the visitors.

    • http://www.razorsocial.com/ Ian Cleary

      Thank you, glad you enjoyed it!

  • Brandon Schaefer

    Ian, great info. I’m going to give the installation a try myself. I’d love to see you in a short YouTube video walking everyone through how to do it as well.

    • http://www.razorsocial.com/ Ian Cleary

      Thanks Brandon, I haven’t done video for a while but you’re right it would be good for this one!

  • Zoom Analytics

    Hi Ian – after reading all the hassle you had to go through just to define one click I guess you appreciate the ease you had defining the same click using Zoom Analytics’ ClickWizard… plus, ClickWizard works also on elements without an ID, which are very common. Continue bringing interesting articles…

    • http://www.razorsocial.com/ Ian Cleary

      Yes, you’re right, it was a little more straight forward with zoom!!! Keep me informed with your progress!

  • Jeniffer Maben

    What a fantastic tutorial of Google tag manager. I read on Google itself but here is more clear and helpful. Thanks a lot for your this efforts.

    • http://www.razorsocial.com/ Ian Cleary

      Thanks Jeniffer, glad you like it!

  • Yogish Shetty

    Superb tutorial, after reading this tutorial i can understand the benefit of GTM and also i came to know how easily i can use this. Thank you so much Lan

    • http://www.razorsocial.com/ Ian Cleary

      You are welcome, thanks for the feedback Yogish. We love to get comments! Ian

  • Justin

    Fantastic description! Maybe the most straioght-forward and easy to understand I have read yet, nice job! :)

    • http://www.razorsocial.com/ Ian Cleary

      Thanks you Justin, glad you found it useful.

      • Justin

        You’re welcome Ian!

        I have a question.. I’ve been trying to implement the method you outline above for tracking link clicks using a firing rule to fire if the element id contains a certain string of text. the element on my page looks something like <a href="/xxx" id="yyy-yyy-yy-2-image-chase_gif".

        I created a rule to fire on gtm.click and another rule to fire when {{element id}} contains yyy. I also set up the click listener correctly, and told the tag to pass the full {{element id}} as the action. The tag still does not seem to fire on click of the link.

        Any help you can provide would be greatly appreciated!

        Thank you,

        Justin

      • Justin

        You’re welcome Ian!

        I have a question.. I’ve been trying to implement the method you outline above for tracking link clicks using a firing rule to fire if the element id contains a certain string of text. the element on my page looks something like <a href="/xxx" id="yyy-yyy-yy-2-image-chase_gif".

        I created a rule to fire when {{event}} contains gtm.click and another rule to fire when {{element id}} contains yyy. I also set up the click listener correctly, and told the tag to pass the full {{element id}} as the action. The tag still does not seem to fire on click of the link.

        Any help you can provide would be greatly appreciated!

        Thank you,

        Justin

  • Peter Davidson

    Hi Ian, thanks for the tutorial. 2 points though. In your last PDF example, I believe the screenshot should show Tag Type:Link Click Listener

    Also not sure if it matters but the {{event}} firing rule for the listener I have elsewhere is gtm.linkClick

    Not sure if the capital C matters

    • http://www.razorsocial.com/ Ian Cleary

      Great,thanks for your feedback Peter!

      • http://jonasn.nu/ zanoii

        Yes, this is the case. I followed your example and it was not working. After changing to gtm.linkClick with a capital C everything worked fine.

        Thanks for the article and also thanks to Peter for this correction.

  • http://www.studioforty9.com/ Zahid Aslam

    Hi Ian.
    Thanks for the great article.
    Any idea when someone would set up a tag of type ‘Google Analytics / Universal Analytics’ as opposed to ‘Event Listener / Link Click Listener’?

  • diegojoker

    Hi Ian, I created a GA event and the two rules exactly as you have shown above. But I’ve been trying for three days and always get this result in preview mode. Do you have Any idea what is happening? Thanks!

    • http://www.razorsocial.com/ Ian Cleary

      Sorry can’t tell anything from what you provided.

  • http://www.ncrpages.in/ Pradeep Sharma

    Hi Ian Cleary,
    I have tried so many times but it’s not performing well. please tell me can i use both tracking code(google analytic and google tag manager) on same webpage.?

    and also tell me what is the syntax to start it in regex rule textbox.?

    • http://www.razorsocial.com/ Ian Cleary

      Hi Pradeep, it’s quite a complex tool and the best way to get it working is following the Google instructions. I did find it tricky and I haven’t looked at it for a couple of months so the documentation will be a better approach than me!

  • http://www.ncrpages.in/ Pradeep Sharma

    Also clear me that which i can use “equals” or “contains” for {{Element id}}, because some others sites, it is “equals” rather than “contains”

  • Trevor

    Question: I send out a email blast with a direct link to PDF (ex. http://www.site.com/document.pdf)

    This link is not on my website in any of its pages at all and really want to track how many times this gets clicked on/downloaded from that link in the email.

    Can this still be accomplished using Google Tag Manager?

  • Jens M Eichkorn

    Hi Ian,
    I think in your case the tag will fire on every click. Because If you set up 2 different rules, it will fire if one rule is fulfilled.
    To fire the tag only if both conditions are fulfilled, you need to set up one rule with both conditions in it.
    And with this set up (one rule with condition event = gtm.click and elementID = formSubmit) it doesn’t work for me :( Seems to not find the element ID. Any ideas? Thanks!

  • necum

    Regular expressions are not wildcards.

  • Sana Sattani

    Can RDF’s be used in Tag Manager ??

  • Jevan Rey Dalangbayan

    How about if I wanted to track my videos clicks on my page and not a youtube video (vimeo). thanks