Quantcast
Channel: Ionic Forum - Latest posts
Viewing all articles
Browse latest Browse all 228595

Google analytics error

$
0
0

Hi,

I'm having trouble using the google analytics cordova plugin. I followed exactly the procedure explained here:
https://blog.nraboy.com/2014/06/using-google-analytics-ionicframework/

However, when I do so, I get a "Uncaught ReferenceError: analytics is not defined". Should I load any js file somewhere, besides just doing "cordova plugin add https://github.com/danwilson/google-analytics-plugin.git"?

Here is my app.js:

angular.module('myapp', ['ionic','ionic.service.core', 'ngCordova',  'ionic.service.push'])
.run(function($ionicPlatform) {
    $ionicPlatform.ready(function() {
        if(typeof window.analytics !== undefined) {
            analytics.startTrackerWithId("UA-XXX-X");
        } else {
            console.log("Google Analytics Unavailable");
        }
    });
})

Thanks in advance for your help!


Viewing all articles
Browse latest Browse all 228595

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>