Javascript hacks & scripts for analytics

My own memo for different javascript hacks for Analytics

Feel free to use or hack more…

1. Populate Adobe Analytics event when page is reloaded/refreshed

if(window.performance.navigation.type  == 1 ){
if (s.events) s.events +=",event94"; else s.events="event94";
}
// Just change event number to whatever you would like to use.

Additional tip: Adobe Dynamic Tag Management: do not fire rule if page reload or refreshed

2. Make sure you send all important page dimensions with custom hits (even if user is inactive over 30min and then makes a click)

if (s.linkTrackVars) 
{
s.linkTrackVars +=',eVar1,eVar2,eVar3'; 
}
else 
{
s.linkTrackVars='eVar1,eVar2,eVar3';
}

+ Till’s great tips for custom codes: http://apastebin.tumblr.com/