Add Analytics to Your Android App using Version4 SDK

As we know, Google has removed the option of creating App Analytics property. Now, it only provides an option of selecting Firebase Analytics while creating a new property. We can still implement traditional App Analytics.

Please check the steps below, which shows how to create traditional App Analytics and get traditional App Reports.

1)     While creating property select “Website”

2) After creating website property. Create new view within Property and select “Mobile App”

3) In this view, you will see all traditional reports. In this way, we can escape from Firebase reports and work with the traditional Analytics ( I highly recommend to have both Firebase Analytics and Traditional Analytics using the GTM)


Now, we move towards an implementation.

The Google Analytics Android implementation has 6 steps.

  1. Add code in the AndroidManifest.xml file
  2. Add to code to the project level Gradle
  3. Add to code to the App level Gradle
  4. Add Global Tracker File
  5. Add “AnalyticsApplication” Class
  6. Add Screen Tracking and Event Tracking code

1)     Add code in the AndroidManifest.xml file

Update your project’s AndroidManifest.xml file to include the INTERNET and ACCESS_NETWORK_STATE permissions:

<manifest xmlns:android="//"

  <uses-permission android:name="android.permission.INTERNET"/>
  <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>

  <application android:name="AnalyticsApplication">

Both highlighted part is important, even if you miss one, app won’t work and send data to the Google Analytics


2)     Add to code to the project level Gradle

Add the following dependency to your project-level build.gradle:

dependencies {
  // ...
  classpath ''

3)     Add to code to the App level Gradle

dependencies {
  // ...
  compile ''

4)     Add Global Tracker File

Create the file app/src/res/xml/global_tracker.xml with the following content:

<?xml version="1.0" encoding="utf-8"?>
  <string name="ga_trackingId" translatable="false">${YOUR_TRACKING_ID}</string>

Replace ${YOUR_TRACKING_ID} with your tracking ID.

5)       Add “AnalyticsApplication” Class

Add “Analytics Application” class from the below URL:

6) Please download all the files and check “” file. Once this setup is done you may send any data to the Google Analytics.

Download Code from the Google Drive:



You may also like...

Leave a Reply