AdWords is now Google Ads. Our new name reflects the full range of advertising options we offer across Search, Display, YouTube, and more. Learn more

2.4K members online now
2.4K members online now
Learn how to set up goals and Ecommerce tracking, verify accuracy of attribution traffic sources, and discuss funnel visualization, Multi-Channel Funnels, the Goal Flow Report, and Enhanced Ecommerce
Guide Me

Tracking Event Clicks In Footer

Visitor ✭ ✭ ✭
# 1
Visitor ✭ ✭ ✭

Hi all,


I'm setting up GA to track clicks on three separate items:


 - Contact Page e-mail address

 - Contact page telephone number

 - Sitewide footer e-mail address


The first two I've sorted, by adding this code to the header of the contact page:


* Function that tracks a click on an outbound link in Analytics
* This function takes a valid URL string as an argument, and uses that URL string
* as the event label. Setting the transport method to 'beacon' lets the hit be sent
* using 'navigator.sendBeacon' in browser that support it.
var trackOutboundLink = function(url) {
   ga('send', 'event', 'Contact Us Page', 'click', url, {
     'transport': 'beacon',
     'hitCallback': function(){document.location = url;}

And then amending the links so they look like this:


<a href="" onclick="trackOutboundLink(''); return false;"></a>

GA is showing the events and it's all tracking as it should (so far!).


My issue comes with tracking the same e-mail address in the footer of the site.  I can't figure out how to do this without it causing some type of error on the contact page (given that the '' address would be tracked by both the event specific to the contact page, and that for the footer).


If I add the first bit of code to the header of the site in general, and then amend the footer link as needed, it would work fine on all pages, but then wouldn't there be a conflict when someone clicks on the email address in the footer when on the contact page?  GA would track it twice under both events wouldn't it?


Hope that makes sense.  Just let me know if not!


Thanks in advance.