// custom event and page tracking helper functions var customGATracking = { // track a specific event then redirect to new location if needed eventTrack: function(cat, act, opt_label, opt_value, follow) { if (!follow) var follow = false; dataLayer.push({ 'event': 'GAEvent', 'uaCat': cat, 'uaAct': act, 'uaOptLabel': opt_label, 'uaOptValue': opt_value }); if (follow !== false) { window.location = follow; return false; } }, // track a custom page view pageTrack: function(uri, pageTitle) { dataLayer.push({ 'event':'VirtualPageview', 'vpURI': uri, 'vpTitle': 'Virtual Page View' }); }, // track specific links being clicked linkEvent : function(cat, act, val, uri) { customGATracking.eventTrack(cat, act, val); setTimeout(function() { window.location = uri; }, 500); return false; }, crossEvent : function(){ ga(function(tracker) { var clientId = tracker.get('clientId'); }); } };