I try to track the clicks on all mailto-links on my site using the Tag Manager, but its not working at all. Looking at the network transfer using firebug I can see that nothing is submitted to Google (and of course also nothing appears in my Analytics interface).
I have bind the push to the click using jQuery (correctly loaded on my page):
$(function() {
$("a[href^='mailto:']").bind("click", function() {
dataLayer.push({
'event': 'GAevent',
'eventCategory': 'Mail Link',
'eventAction': 'clicked',
'eventLabel': 'My Event Label'
});
});
});
Then in the Google Tag Manager interface I set up a Tag as Google Analytics Tag with proper Web-Property ID (like UA-XXXXXX-X). Type is set to 'event' with the following parameters:
Category: {{eventCategory}}
Action: {{eventAction}}
Label: {{eventLabel}}
The field for value is empty, non-interaction is not set.
To trigger the event I set up a rule {{eventLabel}}
equals My Event Label.
Of course I have also created the following Macros:
Name: eventLabel
Type: dataLayer variable
Name of variable: eventLabel
Name: eventCategory
Type: dataLayer variable
Name of variable: eventCategory
Name: eventAction
Type: dataLayer variable
Name of variable: eventAction
Name: event
Type: user defined event
Do you see any errors in this? Why is nothing sent to Google?
I know that i.e. the user defined variable is actually not needed but I don't see a problem in having it set up anyway.
The jQuery selector is also fine, when I bind console.log
the the same event I can see it my message in the console.