I am having a issue with google analytics tracking my events from time to time.
We use asynchronous code for all of our tracking.
When i click the HOME button on header of my webpage, we wanted to have the click of HOME button tracked and browser redirected to HOME page.
jQuery basically rewrites the links to add google custom tracking code.
/* Function to automatically add tracking to links on header Home */
var onClickValue="_gaq.push(['_trackEvent', 'MAIN_NAV', 'CLICK_HOME_BUTTON', '"+linkValue+"']);"
The above jquery rewrites the link
<a class="nav-btn active" id="btn-home" href="/group/gi/index.htm">Home</a>
<a class="nav-btn active" id="btn-home" href="/group/gi/index.htm" onclick="_gaq.push(['_trackEvent', 'MAIN_NAV', 'CLICK_HOME_BUTTON', 'Home']);">Home</a>
When i say it works time to time, it means that some time when i click it tracks and some other time it doesn't. So when digging deep into the issue, some one figured out that the page refreshes even before Google could receive the tracking code. So they are asking me to introduce a delay of 100 milliseconds for each anchor within the website, which i feel is not right. There should be some other way for this. So wanted to turn out to experts here and get an opinion on this.