Hello,
I’m trying to add google analytics for our mobile app.
I’m wondering if it is possible to just reuse the same code we have for the website, since ionic app is running like a website…
Thanks!
Hello,
I’m trying to add google analytics for our mobile app.
I’m wondering if it is possible to just reuse the same code we have for the website, since ionic app is running like a website…
Thanks!
Here’s a plugin to integrate Google Analytics. .
Or the ngCordova implementation of it: http://ngcordova.com/docs/plugins/googleAnalytics/
or if you want to build something easy on your own --> add your GA-Code at the end of your body --> in your base controller of your app listen an the $stateChangeSuccess-event of the ui-router --> and trigger page view tracking with ordinary GA JavaScript SDK
I add additional data to my states like “page title” --> an i pass this title and url to my page view tracking.
Thanks for the reply! Not sure do I need a different tracking Id for the mobile. I saw on the plugin page, I need to enable the mobile sdk for the google analytics. I’m thinking just use the same javascript code and same track id for the ionic app, which is much easier for me.
This sounds like a good solution for me. Just want to make sure that I can use the same piece of Javascript code and same tracking Id I use in my website?
Hi,
I just tried to use the same Javascript code snippet in ionic app. I can see the tracking in desktop mode with ionic serve. However, in the real app running on the phone, it does not show on the Google analytics admin console.
So I’m wondering if the code does not work in the ionic app, as it is accessing all the local javascript files.
Let me know if that works out.
I’m looking to implement Google Analytics in my apps and I haven’t gotten started with it yet. So if implementing the JavasScript code is enough that would make things easier.
only javascript code seems not working…
I have to use the plugin, but the plugin seems easy to use.
Just install it and you can start tracking.