javascript - Track Links Using Events - Race Conditions -


i building angularjs applications have common header links each of application:

<a href="https://app1.company.com">app1</a> <a href="https://app2.company.com">app2</a> 

each application running on own subdomain , when user clicks link on header - page redirects application.

i have track user actions links, e.g. onclick events omniture (but problem applies google analytics well). when add onclick event calls function send event omniture, e.g.:

<a href="https://app1.company.com" ng-click="tracklink('header-app1')">app1</a> 

tracklink() function of angularjs service, brief implementation:

tracklink: function (evar8code) {      s = this.getsvariable(s);      s.evar8 = evar8code;     s.prop28 = s.evar8;      this.sendomnituremessage(s, send, false);      return s;   }, 

the function executes asynchronously , returns right away. standard link's behaviour kicks in: page redirected url defined in "href" attribute. new page loaded (around 70 ms) ajax request omniture has not been executed: it's async.

i believe using events links incorrect approach, 1 should rather use query parameters, e.g.:

<a href="https://app1.company.com?ilink=header-app1">app1</a> 

but it's hard convince marking guys.

what practise track events on links?

change function include short timeout (probably you'd let return false suppress default link behaviour, too, , redirect via location object).

google analytics has hit callbacks executed after call google sent, might want if adobe analytics has similar (as can used redirects after tracking call has been made).

if event tracking , query parameters interchangeable depends on use case (they measure different things). event tracking accepted way link tracking.


Comments

Popular posts from this blog

android - MPAndroidChart - How to add Annotations or images to the chart -

javascript - Add class to another page attribute using URL id - Jquery -

firefox - Where is 'webgl.osmesalib' parameter? -