I’m trying to get Google Analytics to work on my app. I’m using Dan Wilson’s plugin:
So far I have:
$ionicPlatform.ready(function() {
try {
if(typeof analytics !== 'undefined'){
analytics.startTrackerWithId('XXXXXXXXXX');
analytics.trackView('Screen Title');
} else {
alert("Analytics could not be loaded.");
}
} catch(e) {
alert(e.message);
}
}
I’ve put the correct ID there, but I’m not sure what to do with the trackView.
How does it work? Should there be one per app? Or per controller that I want tracked?
What should the value be? How does it link to Google Analytics?
I use the trackView per view. So in each controller I pass the name of the page (you decide what makes sense for you). The way it links to Google Analytics is by showing the screen name based on the value you passed. For example this is what I have in the controller for my search schedules page:
I did exactly how Brandy showed, and it worked fine. I was just asking because, as the analytical data takes a while to appear, I wanted to make sure I was understanding and implementing it correctly.
If you’ve waited for a few days and still nothing appears on Google Analytics, then unfortunately I’m not sure where you’ve gone wrong. Check Brandy’s post, it should be able to help.
Hey, I’m not familiar with adding custom dimensions, but the docs say it should be like this window.analytics.addCustomDimension('Key', 'Value', success, error). Maybe you need to pass a success and error function?
I’m trying to use Analytics in my Ionic app but something is wrong… I saw your printscreen of google analytics and saw that you created in GA an App and not an website.
Did you finally figure it out? I can see my connection in real-time, but somehow can’t get tracking data to show up. Do I need to create a mobile app as opposed to a website?