Google Tag Manager (GTM) is a great tool that can really streamline the implementation of your favorite web analytics tool. Basically, you put a container tag on your site by editing your template and then you should be able manage the configuration and the data collection process of your web analytics tool without touching your template again. You should be able to do it, but the truth is you are not because of the dreadful lack of documentation about this tool.
Nobody can tell you to RTFM™, because there is no manual. Oh yes, there are a couple of nice videos that are quite useful if you want to have an idea of how the thing works, but nothing that can answer the real question every web analytics squirrel/ninja/samurai/whatever is asking, "How can I track events? What about tracking social plugins? Will it work with my current Google Analytics implementation?." People are sad and nobody seems to care. This post will hopefully give answers to some of your questions and teach you how you can install and configure GTM to track Google Analytics events.
First warning: I have tested every configuration and code example many times, but your mileage may vary. Be careful! Test your configuration in a new Google Analytics profile, and don't hate me if you screw your beloved data.
Second warning: There will be a bunch of words and (simple) JavaScript code snippets. I will also throw around screenshots and a puppy picture to balance the JavaScript ugliness, and because I have been told that SEOmoz people love screenshots and puppies?
Tools You Need (and you should already have)
- Google Chrome: Chrome has a nice JavaScript console (press Ctrl+Shift+j to see it) and support a couple of useful extension. The JavaScript console is a life saver when you need to debug your tracking code implementation.
- GA Debugger: this is a must and will save you time and headache.
- Tag Assistant: not required but sometimes useful to give you some extra info.
- A Google Analytics account and a Google Tag Manager Account: 'nuff said
- A text editor (I love Sublime Text and Vim, choose your own weapon but please don't use MS Notepad: every time you use MS notepad to do some serious text editing a kitten may cry).
Tracking Google Analytics Events: The Easy Way
Everybody and his grandmother knows how to track events with Google Analytics. We will briefly review this basic technique to better understand what will happen when things will get complicated.
To track events with Google Analytics basically you bind a function (or a method call) like the following to a user action (actually a DOM event, but let's keep thing easy):
_gaq. push (['_trackEvent', category, action, opt_label, opt_value, opt_noninteraction]);
For the meaning of the various parameters just read the relevant Google Analytics help pages. Usually people bind the call above to a link with the following syntax:
<a href="#" id="targetLink" onclick= "_gaq.push( ['_trackEvent','My Category','My Action','My Label'] );"> Click here to be awesome</a>
A better way to do the same thing is to separate the JavaScript logic from the HTML markup creating a small function that you can put in the head
of your HTML pages surrounded by the usual script
tag. This can be done in more than one way and since I'm lazy I will use JQuery, a library that most sites already use and that make JavaScript looks a little bit nicer:
$(function () { $('#targetLink').click(function () { _gaq. push (['_trackEvent', 'My Category', 'My Action', 'My Label']); }); });
Binding Google Analytics functions in this way will make your life easier and your code will be both cleaner and easier to maintain. Plus, it will make you look cool at parties (if this does not work at a party is not you, it's the party). As I said before in the example above I used the mighty JQuery library, but if you are not already loading the library on your websites you should consider the following implementation that doesn't need any external libraries.
// Hey! I stole this code from Google itself https://goo.gl/wiMYe function addListener(element, type, callback) { if (element.addEventListener) element.addEventListener(type, callback); else if (element.attachEvent) element.attachEvent('on' + type, callback); } var mylink = document.getElementById('targetLink'); addListener(mylink, 'click', function() { _gaq.push(['_trackEvent', 'My Category', 'My Event', 'My Label']); });
Tracking Events with GTM: The First Way
The GTM gives you a set of tools to manage your tracking tags: rules, macros and the data layer. You need to understand and master these tools to leverage the full power of the Google Tag Manager. However some implementations are still possible without creating new macros and rules.
In this post I'll assume that you have already created a GTM account and published a container with a Google Analytics tag. In you don't know how to start have a look at this post by Justin Cutroni. Tracking Google Analytics Event is a three-step process:
First Step
In the Google Tag Manager go to the Google Analytics tag panel and check the "Tracker Name" check box in the Google Analytics "Advanced Configuration". Enabling this option will let you access the Google Analytics Tracker object from an external script. This is needed because GA tracking object is otherwise "hidden" in the container and not accessible from other scripts.
Second Step
Create a new "Custom HTML Tag". In this kind of tag you can put almost whatever you want. Paste in the text box the following code:
<script type="text/javascript"> $(function () { $('#targetLink').click(function () { _gaq. push (['_trackEvent', 'My Category', 'My Action', 'My Label']); }); }); </script>
As you can see I used JQuery because I'm lazy, but you can use something like the "no extra dependencies" JavaScript implementation I showed you before. If there is any syntax error in your code GTM will complain and will not accept your code, so you better test it before creating the tag.
Third Step
Every time you create a tag in GTM you must associate it with a rule, otherwise the tag will be never fired. The GTM comes with a simple rule that fires the tag in every page (you should be already using it to fire the Google Analytics tag), so you only need to:
- Scroll down in the page where you have pasted the above code
- Click on the "Add Rule to Fire Tag" button
- Select "All Pages"
- Click on Save
OK, now you are almost done. The only thing left to do is creating a new version of your container and publishing it.
A note on version naming: always give your version a name that let you easily identify it; it will save you a lot of headaches. I like to give a name based on the difference from the previous version, for example "Added event tracking", "Testing social tracking" or something like that. In this way you can easily roll back to a previous version if something goes wrong.
Debugging Your Published Container
Now your new spiffy container should be up and running. Let's open a new "Incognito Window" in Google Chrome, activate the GA Debugger and open the JavaScript console (Ctrl+Shift+j). We want to make sure that all the data is traveling smoothly to the Google Analytics server. I suggest the following checks:
- Check if the page views are tracked correctly along with the source of the visits.
- Try to simulate a visit from different sources (search engines, referral, ect...). Does the data sent by to the Google Analytics server change accordingly?
- Try to click on the link that should fire the Google Analytics Event. Do you see the expected data sent to the Google Analytics server? If everything works you should see something like this:
Tracking Google Analytics Events with GTM: The Second Way
The first way is simple, but should make you feel a little bit guilty because we are not using the full power on the GTM platform. Now we will see how to make a better implementation using all the tools that the GTM gives you. Let's make a roll back and restore the previous version of the GTM container. To do this go to "Versions">"Overview" and select the previous version of the code, then click "Restore". A pop up will show up asking you to confirm: uncheck "Create a new container version from the current container draft before restoring." and then click again on "Restore".
1. Create Macros
A macro in GTM is just a place where you can store values that you can access later when you build tags or rules. A macro can capture and store values coming from different sources: cookies, referrer, URL, etc... But the most important source of data for a macro is the data layer. In fact every data layer variable can be stored in a macro. So, macros are like pipes connecting what happened on your website with your tracking management logic.
Since using GTM the Google Analytics tracker object is not directly available we will push the Google Analytics event data to the data layer and then send that data to Google Analytics via macros. This stuff seems very complicated, but when you get used to this kind of logic everything takes its place nicely.
Let's create five macros (a macro for each of Google Analytics event parameters). We will need to do it only once and then we will reuse the same macros to track every future GA event data. Creating macros is easy, just keep the following rules in mind:
- Provide a descriptive name that will help you identify and reference each macro
- Choose "Data Layer Variable" as the macro type
- Provide a variable name following a consistent convention. Have a look at the variables names suggested by Google for inspiration
At the end of this process you will have something like this:
- Macro Name: Event Category -> Data Layer Variable: eventCategory
- Macro Name: Event Action -> Data Layer Variable: eventAction
- Macro Name: Event Label -> Data Layer Variable: eventLabel
- Macro Name: Event Value -> Data Layer Variable: eventValue
- Macro Name: Event Interaction -> Data Layer Variable: eventInteraction
Great! You have mapped some data layer variable to macros. That means that as soon as you have published those macros, every time you push a variable named for example eventCategory
in the data layer you can insert the value of that variable in a tag or in a rule using the syntax {{ Variable Name }}
. It's pretty cool isn't it?
2. Create a New Google Analytics Event Tag
Now it's time to create a new Google Analytics tag, but this time we well choose "event" as "Track Type". The GTM interface will give you a nice set of input boxes. In each input box, which map to a Google Analytics event parameter, click on "macro" ad select the corresponding macro you have just created. Do you feel a bit confused? Have a look at the following screenshot:
3. Create and Sdd a Rule to the Tag
OK, so at this point we have a set of macros and a new tracking tag, but we need to add a rule that will fire the newly created tag.
With the GTM, every time you need to track user interaction with website elements, such as links and buttons, you need to build rules based on a special data layer variable called event
. Pay attention: this event
variable has nothing to do with "Google Analytics Event", it's a generic concept that can be applied to other analytics tags. Here is what the Developers Guide says about "events":
Google Tag Manager provides a special data layer variable called an event that is used within JavaScript event listeners to initiate tag firing when a user interacts with website elements such as a button. For example, you may want to fire a conversion tracking tag when a user clicks the Submit button on a newsletter signup form.
The only thing you need to remember is that every time you want to track a user interaction with a page element you must build a rule that fires a tag based on the value of the data layer event
variable. Our rule will fire the Google Analytics event tracking tag when the value of the data layer event is set to GAevent
.
4. Bind the Link to a Data Layer Function
Now we are almost ready; let's review what you have now:
- A new Google Analytics Event tracking tag
- A set of macros to capture and store the values of Google Analytics events parameters
- A rule to fire the tracking tag when a user interaction occurs on the page
The only thing left to do is binding a function to the link we want to track. The function will push the proper data in the data layer and trigger the Google Analytics Event tracking tag.
You could this hard coding a function in the HTML code like this:
<a id="targetLink" href="#" onclick="dataLayer.push({'event':'GAevent', 'eventCategory':'My Category', 'eventAction':'My Action', 'eventLabel':'My Label'})">Click here to be awesome</a>
That would work but, you know, mixing HTML and JavaScript is for losers and you want to be super classy, so let's create a custom HTML tag in Google Tag Manager and paste the following code in the box.
<script type="text/javascript"> $(document).ready(function(){ $('#targetLink').click(function(){ dataLayer.push({ 'event':'GAevent', 'eventCategory':'My Category', 'eventAction':'My Action', 'eventLabel':'My Label' }) }); }); </script>
Then give this custom HTML tag a rule that will fire it in every page (now you should know how to do it).
5. Preview, Debug and Publish (and debug again)
If all the tags, rules and macros are properly configured you are now ready to create a new version. Resist the temptation to publish immediately and choose "Preview & Debug" in the Preview sub menu. The "Preview & Debug" function will allow you to test you configuration before publishing the container and check if the tags are fired in the proper way. If all looks OK you can go back to the GTM administration panel and publish the new version of your code. I strongly suggest that you check again, after you have published your code, with the GA Debug extension: this is the only way you can be 100% sure that the code is executed the way it should and all the data is being sent to the Google Analytics server.
Conclusion
If you survived this tutorial you could be wondering: "Is it worth using the Google Tag Manager? All this code and configuration stuff seems super complicated!". My answer is yes and yes. Google Tag Manager is a bit complicated because is a general tool that should work with any of your tracking code ("...one container to rule them all...). To accomplish this goal it gives you some tools and the freedom to glue them together in different ways. On the other hand GTM is still a young product and Google is actively working on it to improve the interface and the basic configurations options. At the end of the day I think that learning how to use it properly is good investment.
As I promised since you survived this tutorial you deserve a "hi-five" by this super cute puppy! Have fun with the Google Tag Manager!
Is there any reason why every GA event I fire through GTM is counting every visitor twice?I have tried EVERYTHING to figure out why visitors are being counted twice (they are sent TWO _utm.gif's) on pages where I fire an GA event using GTM.
Here's a quick synopsis of my setup:
------------------
TAG: Google Analytics Event
Tag Type: Google Analytics
Track Type: Event
Event Tracking Parameters:
- Category: {{Event Category}}
- Action: {{Event Action}}
- Label: {{Event Label}}
- Value: {{Event Value}}
- Non-Interaction: {{Event Interaction}}
------------------
------------------
FIRING RULE:
Rule Name: GA Event
Conditions:
{{event}} equals GAevent
------------------
...and then on my webpage I basically have this:
<html>
<head>
</head>
<body>
[GTM SNIPPET IS HERE]
<script>
dataLayer.push({
'event':'GAevent',
'eventCategory':'the category',
'eventAction':'the action',
'eventLabel':'the label',
'eventValue':'2.00',
'eventInteraction':'true'
});
</script>
</body>
</html>
The event fires and is recorded, but the event/visitor is counted twice in Google Analytics.
I don't understand why?
I've even tried moving the dataLayer up ABOVE the GTM snippet and not using the .push command, but I get the same result (double counting).
If I get rid of GTM and the dataLayer, and revert back to just the raw GATC and standard GA event tracking using _gaq.push it works exactly as it should... only counting the visitor and event once.
If anyone can shed some light on why this is happening to me I would be sooo grateful. Thank you all so much for any guidance.
Ever find a solution to this? We've found something similar.
Cuz probably you have the GA tracking code installed + GTM code (which run GA tracking code as well) = that's why you GA code is running twice and you get two visitors. Hope that helps
I second Michael comment, took me a bit time to find out also.
Is that normal, that I found 3 times the same Google Tag Manager code on every single page of my website?
My bounce rate also went to 0 which is odd i think.
Please need help to understand why the code of was put 3 times on a single page.
thank a whole lot of any reply in that regard
Unrelated comment, so I am sorry, but is it normal for the Realtime area of GA to stop showing data when using the GTM vs. the raw, full analytics tracking script?
Survived this tutorial :)
Trying to use this tool.
Hoping to use it properly!
It's really hard initially but once you get it it's not that hard.
Great post! Is this setup correct? Will the Analytics Goal be recorded by the following setup
Tag: GA tracking code
Tag: Goals w. macro below
Macro: (As specified in post) Event Action > eventAction; Event Category > eventCategory; Event Label > eventLabel etc.
Rules: GA Event > GAevent
Triggered by JS: dataLayer.push({ 'event':'GAevent', 'eventCategory':'Forms', 'eventAction':'Send', 'eventLabel':'Request' })
In Google Analytics:
1st Goal: Category > Forms; Action > Send; Label > Request Form
2nd Goal: Category > Forms; Action > Send; Label > Contact Form
I followed your steps to make this happen. I also ran GA Debugger and verified that the event is firing.
Hit Type : event
Event Name : Phone
Event Type : Click
Event Label : Header-Else
I am not seeing the events being tracked in GA -> Content -> Events
Am I missing something? Please let me know if you need any other information about my site. Thank you!
It may take some hours to see the Events inside the Content/Events panel!
You may have some luck looking for them in the "realtime/events" panel instead!
I completed these steps 5+ days ago and still no tracking events in GA. I do not see any Real-Time Events either.
I figured it out. I had an error in my Custom HTML.
Great article. Solved a couple of questions I had.
I just found a typo. In your example you're using an "onlick" event and I guess you meant "onclick". Did some copy/paste here and I didn't noticed! :)
Fixed. Thanks for letting us know!
Ale,
Currently in the process of implementing GTM on a number of client sites and think readers might benefit from an extra step in your version 2.
Writing the function call in Step 4 is perfect, however, there is no definition of the inline code that is being pushed to the data layer. How would you expect this to look given your above example of the function?
Here is a better example...
<a class="gtm-social" href="http: //www.facebook.com/page" target="_blank"
onclick="dataLayer.push({
'event': 'social',
'event_category': 'social', //same as dataLayer.push.event
'event_action': 'social',
'event_label': location.href,
'event_value': parseInt(0.00),
'event_nonInteractive': false, // Is this an onload action? Y|N
'network': 'facebook',
'socialAction': 'like',
'opt_target': location.href, // optional
'opt_pagePath': location.pathname + location.search // optional
'ga_id': '<UA-xxxx-1>',
'ga_setDomainName': '<mydomain.com>'
});>Click here to Like this page</a>
Hello
I have placed event tracking in my websites to track banner clicks. Now I want to track the trasanction ID's as
well for those banners (People click those banners and place an order).
I have read many articles on the subject and this has seemed to me one of the most complete and more understandable than the rest.
Pro tip: look at the date on the post before putting in a generic comment.
Hello,
I have a website example.com & have mobile site m.example.com as a sub-domain, when users access the site example.com from mobile-devices they are redirected to m.example.com, what is the right & best way to set-up GTM for this case? Thanks
I am implementing GTM for Android application, Followed your instructions and it was helpful,understood what macro's is all about. But still I could not figure it out where this {{Event Category}} etc values will be reflected.
How can I use these values to interact with Google Analytics?
How Can I use default macros and rules to interact with google analytics?
Should I remove Existing Google Analytics Code from Application ?
I am struglling with GTM, dont know how it is going to add some value to my Google Analytics.Some help appreciated.
Thanks for this post..
Can you please help me my tag manager is not working for my website:
Below is the tag manager Code
<!-- Google Tag Manager --> <noscript><iframe src="//www.googletagmanager.com/ns.html?id=GTM-52J4DV" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> <script>(function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start': new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0], j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src= '//www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f); })(window,document,'script','dataLayer','GTM-52J4DV');</script> <!-- End Google Tag Manager -->
The {{event}} is sadly missing in the current version of the Google Analytics Tag Manager.
Do you have got an advice how to implement a clicktracker without the definition of the event?
Even the official Tag Manager manuals still include the event click rule.
Hi NewNewNew,
Ran into this issue before. You can create the macro yourself. Create a new macro called "event" with an event type as "Custom Event." You can then use this macro to create your rules.
Awesome article, helped immensely!
Hi alemartin,
I have the following situation:
I have a cookie tool that is loaded through GTM and that works perfectly. The cookie tool asks the user if they accept cookies or not and according to the answer, Google Analytics is loaded or not (also loaded through GTM).
Following method 2, events will always be fired even though visitors declines the usage of cookies and thus declines the use of Google Analytics.
How can fix this so events will only be fired when visitors accepts cookies?
Hi Ifshiu,
I think you can solve your problem building a new Rule based in a Custom event macro:
So the event will be fired only if the user accepts cookies.
Hope this helps!
Right on time mate!I've been busy lately and I really tried hard to catch up with the tag manager.This explains everything I need to know - plain and simplethanks for another great post.
Good job in this article to show lots of new point, thanks
I really liked the article as well.
So here's the missing event tracking manual! This has been my issue with GTM, the documentation is scarce, the videos, even the more technical G+ hangouts didn't really delve into event tracking - which pretty much all of our clients use.
From the GTM homepage: "Google Tag Manager is quick, intuitive, and designed to let marketers add or change tags whenever they want"
Intuitive? Nope.
Thanks for going to the trouble of figuring it out and sharing.
GTM was brought to light just earlier this week and I had no idea how it works. This article gave me an idea of how it works but I will definitely need to study or learn a bit more about it. Tough Tool
You are correct. I was sad and nobody cared, and I do like puppies. The Google Tag manager is a good tool, but you are right about the documentation being a little sparse.
In addition to the items you listed I have Google Tag Assistant loaded onto my Chrome Toolbar. It is handy for letting me know what tags are on pages and if that tag is working properly.
Nice to see you here. Good job Ale.
*feels tiny, small and dim*
Wow!
You're right - the lack of documentation has made it difficult to begin using GTM. This is very helpful - I think! (brain ... crushed.)
Thanks!
Hi Matt!
Speaking about documentation: I hope things will get better in the future, but now Google seems super focused on Universal Analytics. Also Google markets GTM as something that allow you not to have to do with your IT department but that's not completely true. You will occasionally need some help from IT and at least a basic JavaScript knowledge.
Ale, fantastic post! Like many of you, we have been searching for such a 'manual'. However, like said above, every digital analytics specialist should have at least basic knowledge of JS.
Ale, awesome job. Well explained and much helpful with Google Tag Manager.
Thanks for sharing. Keep the good work on.
Hi alemartin,
Nice article!!
I have some trouble using Hit Callback in advanced configuration when tracking pageview by GTM Tag Google Analytics.
I tried to set up hit callback.but it just not work!!
whateverr I setting up .GA debug always show below
_gaq.push processing "_set" for args: "[hitCallback,function (){if(z(a["10"]))a["10"]();b()}]":
Is anyone having the same problem?
Great tutorial! I really believe that GTM is a really powerful tool. However, as someone has already said, it's being sold as an intuitive tool that any marketing professional with no programming skills can use, and I guess this could not be more untrue. Actually, I guess GTM is even harder to implement than the usual Google Analytics Event Tracking. So, Google should be a little more careful when saying GTM is almost "IT free", 'cause it's not.
Complicated stuff but nicely put!
So I am going to have to be that guy! How would we apply the above code in example 1 to track videos or the click of a button? Or I guess the question I should be asking is whether this is possible with GTM. I am hoping to not use the data layer implementation, mainly because this does require going back to the tech team.
Tracking the click on a button or on any other HTML element is easy if you assign an id to the element you want to track. Than you just need to change the id in my example with your element id.
Tracking videos is sometimes a bit complicated because it largely depend on the video player you are using, but underlying logic is the same: you need to attach the tracking function (_gaq.push() or dataLayer.push()) to the event you want to track (e.g. play or pause).
Here you can find a nice post from Lunametrics that hopefully will give you more useful details: https://www.lunametrics.com/blog/2012/10/22/automatically-track-youtube-videos-events-google-analytics/
Nice Work Ale,
Wouldn't the first method fire on all pages though? Shouldn't you only fire your event when an event happens?
Hi Jeff.
In the first method the tag will be included in every page but the event tracking will be fired only in the target link is clicked. In other words when the tag is published is just waiting for the "onlick" event to happen.
Hi Alemartin,
I am trying to implement this 2nd Method but i have problem with "Google Analytics Event tag" (Tag Not Fired) for GAevent Rule but as i add another rule to Google Analytics Event tag the rule (All Page), then it is showing all tags are Fired on Tag Manager Load. Please help me.
custom HTML GA Event tag Fired on Tag Manager Load
Google Analytics Event Not Fired
Universal Google Analytics Fired on Tag Manager Load
i think, there is problem with Data Layer Variable Name :event that you described in Step 3. Create and Sdd a Rule to the Tag, rule name GA Event and specified condition :
{{event}} equals GAevent.
i also confused with Data Layer Variable used with Rule Setting of GAevent i.e. Macro Name: event, Macro Type: Data Layer Variable and Data Layer Variable Name :event , and unchecked the check box of default value (as there some changes in GTM for this function) the that we have to create while setting the rule for GA Event.
I have set up with Universal Analytics.
Could you help me to sort out the problem.
I'm sorry but it is really difficult to debug a GTM implementation without having access to the real code. Also I have never tested GTM with Universal Analytics so at the moment I cannot give you any advice :-(
Thanks for Reply back!!!!
I have also implement the 2nd Method as described by you on one of another website fleetrobo.com, this time with Google Analytics, but their is same problem,
Google Tag Manager
Preview Version: 4
Tag Status
Custom HTML Event Tracking Tag Fired on Tag Manager Load
Google Analytics Fired on Tag Manager Load
Google Analytics Event Tag Not fired
I did all the things carefully as described by you in following way:
I have Created Following Macros:
Macro Name: Event Category -> Data Layer Variable: eventCategory
Macro Name: Event Action -> Data Layer Variable: eventAction
Macro Name: Event Label -> Data Layer Variable: eventLabel
Macro Name: Event Value -> Data Layer Variable: eventValue
Macro Name: Event Interaction -> Data Layer Variable: eventInteraction
I have Created a New Google Analytics Event Tag as following:
Tag Name Google Analytics Event Tag
Tag Type Google Analytics
Web Property ID I add this from GA Account something like UA-12345678-1 (ID here is Only for Example Purpose, but i entered original ID)
Track Type Event
Event Tracking Parameters
Category {{Event Category}}
Action {{Event Action}}
Label optional {{Event Label}}
Value optional {{Event Value}}
Non-interaction optional {{Event Interaction}}
Firing Rules
Name GA Event
Description {{event}} equals GAevent
Here Macro Name: event
Macro Type: Data Layer Variable
Data Layer Variable Name: event
<---- I think in this part there is problem, could you explain it with another blog post or live video demo link---->
Bind the Link to a Data Layer Function
Tag Name: Custom HTML Event Tracking Tag
Tag Type: Custom HTML Tag
HTML:
<script type="text/javascript"> $(document).ready(function(){ $('#targetLink').click(function(){ dataLayer.push({ 'event':'GAevent', 'eventCategory':'My Category', 'eventAction':'My Action', 'eventLabel':'My Label' }) }); }); </script>
Firing Rules (1)
All pages {{url}} matches RegEx .*
After Save all tags, i had created New Version and check the Preview and Debug, but
Custom HTML Event Tracking Tag Fired on Tag Manager Load
Google Analytics Fired on Tag Manager Load
Google Analytics Event Tag Not fired
Could you help me now? Please send me the any live video recording link of implementation on my email id [email protected] or post it publicly at the top of this blog post, it will help many webmasters for actual implementation of your method.
Did you change the $('#targetlink") selctor to an id/class on fleetrobo.com?
If you wanted to track, say, the "Apply For Channel Partnership" button, change the the selector to $('.btn-sec tr:nth-child(1) a'); or assign an id to that anchor tag and use that.
Hope that helps.
Thanks Nicholas, means if i want to track 5 different buttons, then i have to use this slector code $('#targetlink") with selector of each button.
One thing more, Whether i need different Custom HTML Tag of each button or single Custom HTML Tag with repetition of following code for each button.
<script type="text/javascript"> $(document).ready(function(){ $('#targetLink').click(function(){ dataLayer.push({ 'event':'GAevent', 'eventCategory':'My Category', 'eventAction':'My Action', 'eventLabel':'My Label' }) }); }); </script>
How this will works for File Downloads..like PDF?
FYI: all the code in the post is messed up.
Is that a translation of your italian article ? good job :)
It's same topic but this is original content. Crafted for the SEOmoz audience exclusively :-)