Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to implement Google Analytics in hybrid mobile apps?

I am writing a hybrid mobile app using HTML5, CSS and jQuery Mobile. I will use Cordova Js to convert the HTML5 app to native mobile apps for iOS and Android. I want to use Google Analytics to track various activities performed by users. I found that GA provides SDKs for native apps but not much was specified for hybrid apps. Have you implemented tracking for Cordova or PhoneGap based apps? Can you provide me some direction on how to do it?

like image 740
TejSoft Avatar asked Feb 10 '23 17:02

TejSoft


2 Answers

I use the ngCordova Google Analytics plugin. You don't need Angular or Cordova to use it http://ngcordova.com/docs/plugins/

The git and docs are here: https://github.com/danwilson/google-analytics-plugin

Easy to use.

Warning! When you set it all up leave it 24hrs to 'propagate' or whatever Google does. People find its not working and go searching for solutions (which cannot be found) and then BAM the next day its all good.

like image 155
Subjective Effect Avatar answered Feb 13 '23 07:02

Subjective Effect


First, in 2019 and later you probably want to use Firebase for mobile app analytics.

Google it.

Second, no matter what you decided to use, Firebase or Analytics, you can

1) use plugin (there some of them for both Firebase and Analytics)

2) just include relative script in your index.html same way you do in web app. In this case in Analytics console you should create 3 different apps (one for each platform), that you can be able to separate user activity on iPhone from Android and Web.

like image 23
yurin Avatar answered Feb 13 '23 07:02

yurin