Question

For some reason the below code will fire fine in Chrome, but not in Safari or Firefox. The Google Analytics code is loaded in the footer of the site. This site is running on jQuery mobile. I am not sure if it's a real time reporting thing in Analytics where it will only work for Chrome, or just not working all together.

I also did a console.log inside the if statement and it fired fine in Safari, so I know it's getting to that point.

// Event Tracking For Bottom Tabbed Menu
$(document).on('click','.single-footer-menu a',function(){
    var label = $(this).text();
    if( typeof label !== 'undefined' ) {
        ga('send', 'event', 'Bottom Tabs', 'Tap', label);
    }
});

To further clarify we are on Google Analytics Universal. I used https://developers.google.com/analytics/devguides/collection/analyticsjs/events as a reference.

As another update. I have replaced the tracking code and events with Google Analytics classic, and it works fine in Firefox/Safari. It appears to be isolated to a Google Analytics Universal issue.

Issue Resolved: I used the Google Analytics Universal embed code to load GA, but used the classic push events for page views and event tracking: _gaq.push(['_trackPageview']);

Apparently you can still use _gaq with Universal Analytics. After I did this, I no longer had sporadic behavior and it worked in all browsers and all devices 100% of the time.

Was it helpful?

Solution

Issue Resolved: I used the Google Analytics Universal embed code to load GA, but used the classic push events for page views and event tracking: _gaq.push(['_trackPageview']);

Apparently you can still use _gaq with Universal Analytics. After I did this, I no longer had sporadic behavior and it worked in all browsers and all devices 100% of the time.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top