Google Universal Analytics - track multiple events on a single link click -


google suggests track outbound links:

ga('send', 'event', 'outbound', 'click', url, {     'hitcallback': function () {         document.location = url;     } }); 

it uses "hitcallback" redirect user page once event has been tracked.

what syntax tracking multiple events per click?

i'd prefer not write code this:

ga('send', 'event', 'outbound', 'click', url, {     'hitcallback': function () {          ga('send', 'event', 'foo', 'click', url, {             'hitcallback': function () {                  ga('send', 'event', 'bar', 'click', url, {                     'hitcallback': function () {                         document.location = url;                     }                 });             }         });     } }); 

any solution needs support ie7+ , have no library dependencies.

i think there 2 potential approaches:

  • rely on assumption ga processes events sequentially , use hit callback last event.

  • use single hit callback counts number of invocations , changes document.location when last expected call received.


Comments

Popular posts from this blog

Magento/PHP - Get phones on all members in a customer group -

php - .htaccess mod_rewrite for dynamic url which has domain names -

Website Login Issue developed in magento -