I am making an app and I want to get analytics from the users. I tried to use the Phonegap Plugin, but I didn\'t have any luck trying to implement it.
I was wonderin
I would like to add my 2 cents. As everybody here I had no luck with analytics plugins, so started to look for pure javascript solution.
I followed this answer and it is working for me. Means, I can see in Google Analytics Realtime separated user activity from browser and from iOS simulator. (Have not tested Android yet.)
I changed script a little.
1)
// if we are in the app (the protocol will be file://)
if(document.URL.indexOf('http://') !== 0){
changed to be
if(document.URL.indexOf('http') !== 0){
to include https case.
2) Unrelated to where I am: in browser or mobile app, I track events like this:
ga('send', 'event', '', '');
so I can track different applications under same Analytics Property.
In Google Analytics I created one Property and under this Property three Views. One of type Web and two of type Mobile.
Applied custom filter(s) to each view:
To iOS view applied Include filter on field Operating System with value iOS
To Android view applied Include filter on field Operating System with value Android
To Web view applied two Exclude filters on field Operating System with values Android and iOS
Happy cordoving!