I've got Google Analytics events set up to track outbound links. I followed the tutorial on Google's site.
The problem that I'm having is that the 'url' parameter (the Event Label) is not being tracked in Google Analytics. 'outbound' and 'click' are both working just fine from the ga() call. If I alert() the 'url' variable on the line before the ga() call, it will alert it to the screen successfully.
Why would the Category (outbound), and the Action (click) work just fine. However, the Label (var url) does not show up in Google Analytics?
jQuery(document).ready(function() {
initExternalLinkLogging();
});
function initExternalLinkLogging() {
// ':external' is from here and works great: http://stackoverflow.com/questions/1227631/using-jquery-to-check-if-a-link-is-internal-or-external
externalLinks = jQuery("a:external");
jQuery(externalLinks).click(function() {
trackOutboundLink(this);
});
}
function trackOutboundLink(url) {
// This is the triggered on each outbound link click successfully
// 'url' has the correct value, but is not showing up in Google Analytics
try {
ga('send', 'event', 'outbound', 'click', url, {
'hitCallback': function() {
document.location = url;
}
});
} catch (err) {
// Do nothing for now
}
}