Last active
December 14, 2015 01:59
-
-
Save davemasse-mam/5010274 to your computer and use it in GitHub Desktop.
It can be difficult to tell what’s being tracked by Google Analytics with the delay between triggering actions in the browser and seeing those records in the Google Analytics dashboard. This is a quick and dirty way to track Google Analytics actions locally to make sure events are being triggered correctly before going to production.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Debugging of Analytics calls via console.log | |
function _gaq_pop() { | |
var max = _gaq.length; | |
// Iterate only up to the current length of the object to prevent issues with _gaq.push being called while in the loop | |
for (var i = 0; i < max; i++) { | |
if (console && console.log) { | |
console.log(_gaq.shift()); | |
} | |
} | |
} | |
setInterval(_gaq_pop, 1000); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment