Implement Google Analytics in Android

This article describes how to implement Google Analytics in your Android Meridian-powered app.

Dependencies for Google Analytics

If you'd like to use Google Analytics in your project, you'll need to add its dependency.

In the build.gradle file inside dependencies { }, add the Google Analytics dependency:

    dependencies {
        // To enable analytics reporting for your SDK app, include this dependency:
        implementation 'com.google.android.gms:play-services-analytics:16.0.1'
    }

To finish enabling Google Analytics for your project, add the following to the build.gradle file:

    android {
        // ...
        defaultConfig {
            // ...
            buildConfigField "String", "ANALYTICS_ID", "TRACKING_ID"
            }
    }

Replace TRACKING_ID with your unique Google Analytics tracking ID.

After calling Meridian.configure(), call MeridianAnalytics.setAppId(appId) to start reporting statistics for your location.