Jimmy Jammmy Jimmy Jammmy - 3 months ago 60
Javascript Question

Google Analytics, Outbound Event Tracking

Having an Issue With recording outbound link events in my google analytics. This is such a simple task I cannot understand where it can go wrong. Can any one notice any issues with my code. The google functions are being executed upon my onclick events, The issue is that no event is being logged on my google analytics dashboard In Behaviour > Events > Overview


(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),

ga('create', 'UA-86854644-1', 'auto');
ga('send', 'pageview');

var trackOutboundLink = function(url) {
   ga('send', 'event', 'outbound', 'click', url, {
     'transport': 'beacon',
     'hitCallback': function(){document.location = url;}

function handleOutboundLinkClicks(event) {

  ga('send', 'event', {
    eventCategory: 'Outbound Link',
    eventAction: 'click',
    eventLabel: event,
    transport: 'beacon'


Click Event





Thanks For the help, I agree that Event Listeners are a better approach especially with multiple event but my initial function and click event worked, Turns out it just took some time for google analytics to present it on my dashboard. Thanks