CardinalPath / gas

Google Analytics on Steroids. A Google Analytics implementation with more power features.
Other
593 stars 78 forks source link

GAS outbound tracking and timeout #63

Closed chook closed 10 years ago

chook commented 10 years ago

The official Google documentation suggests a small timeout before tracking outbounds. How does the GAS implementation tackles this workaround navigation?

I want to implement an onclick custom variable set for a few links and was wondering if I can leverage GAS without throwing my own timeout implementation

tomfuertes commented 10 years ago

Depending on the type of links you can look in (below) to see how it's tracked.

https://github.com/CardinalPath/gas/blob/master/src/plugins/html_markup.js

https://github.com/CardinalPath/gas/blob/master/src/plugins/mailto.js

https://github.com/CardinalPath/gas/blob/master/src/plugins/multidomain.js

https://github.com/CardinalPath/gas/blob/master/src/plugins/outbound.js

To my knowledge GAS uses no delay, but mousedown vs onclick per the findings here:

http://www.cardinalpath.com/experiment-onclick-vs-onmousedown-event-tracking-in-google-analytics/

googleanalyticsresoneo commented 10 years ago

We could also use the hitCallback syntax

_gaq.push(['_set', 'hitCallback', function() {
    _gaq.push(['_trackEvent', 'foo','bar', 'foo bar', undefined, true]);
    _gaq.push(['_set', 'hitCallback', undefined]);
}]);

but needs to handle the case where ga.js is disabled by adblockers / opt-out plugins and similar

tomfuertes commented 10 years ago

Good call @googleanalyticsresoneo! PR Welcome on this. GAS would handle the ga.js disabled / opt-out automatically as the hooks/code don't run unless the ga.js file loads - asynchronous function queuing.