I am trying, through javascript, to identify if Google Analytics or Universal Analytics is loaded.
Some clients still use the old Google Analytics and we want to roll out a javascript that collects data. So i then need to write code for both versions to make sure it gets tracked regardless if its the normal or universal version of analytics.
Classic GA uses the "_gaq" object, and UA uses the "ga" object, so you could check for the existence of either of those
if (_gaq) {
// using classic GA; do whatever
}
or
if (ga) {
// using UA; do whatever
}
Hope this helps.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With