I want to use Google Analytics to collect more information about the use of my applications, how to add Google Analytics to my Android application?
2 Answers
That's was made very easy now a days by Android Studio guys.
i. create analaytics id from Google analytics, sign in to your google analytics account. In the home page -> choose admin -> property column ->click the first dropdown - > press create new property.
ii. In this create property screen you are going give information like whether you need analytics id for website/app, fill information you will get an tracking id.
iii. open your android studio -> your porject - > right click project name- > open module settings -> choose google analytics -> it will list the property name which you have just created, select and click okay. (It will add needed dependencie files)
That's it, you are done add events with trackers to your project.

- 1,805
- 1
- 15
- 29
-
I did the things you said above. But still Google Analytics shows **No Hits** . I am using WebView inside the app. Does it have anything to have with app being getting no hits? – Vishwasa Navada K Jun 15 '16 at 15:59
-
have you added trackers to your web view ? – HourGlass Jun 15 '16 at 17:02
-
I have my webview in Main Activity. so I have called initialize method of analytics in MainActivity.java. i.e. `AnalyticsTrackers.initialize(this);` – Vishwasa Navada K Jun 16 '16 at 01:42
-
okay . But you have to add tracker events to all the things you want to track and see in google analytics. – HourGlass Jun 16 '16 at 02:57
-
Can you guide me on how to add trackers properly? – Vishwasa Navada K Jun 16 '16 at 03:01
-
1The answer in this stackoverflow questin will be useful for you. http://stackoverflow.com/questions/24782901/how-to-integrate-google-analytics-in-android-app – HourGlass Jun 16 '16 at 05:23
I always like to start with a sample, you can try the Google Analytics sample first, you can download it from here.
In order to run it, you have to download a json file and add it to your project's 'app' folder, you can get that from here.
Basically just have to follow this (in comment) page with the sample you successfully build, you should be good to go. It's surprisingly simple to implement specially if you worked with other google services before, good luck!

- 1
- 1
-
https://developers.google.com/analytics/devguides/collection/android/v4/#set-up-your-project – Ivan Chen Jun 06 '16 at 02:21