google analytics - Using multiple trackers with segment.io -


we using 2 trackers on our website gatracker , kissmetrics on our website. using segment.io abstraction layer. want extend functionality of our script events want call gatracker , events want call kissmetrics, how can ?

firstly, i'd mention segment.io uses analytics.js javascript client, open source , can check out source code anytime.

if enable ga , km on segment.io, analytics.js bring ga , km snippets onto page, can still interact "_gaq" or "_kmq" globals have done in past. you'll want wrap calls globals using analytics.ready(..) method, so:

analytics.ready(function () {     _gaq.push(['_addtrans',     '1234',           // transaction id - required     'acme clothing',  // affiliation or store name     '11.99',          // total - required     '1.29',           // tax     '5',              // shipping     'san jose',       // city     'california',     // state or province     'usa'             // country   ]); }); 

analytics.ready(..) call callback function when _gaq , km variables have been loaded (think of jquery $.ready document ready handler).


Comments