Google Play Campaign Measurement allows you to see which campaigns and traffic sources are sending users to download your app from the Google Play Store. In this post i am going to explain you how to create campaign and read data after app is install. Today most of app which implements referral  system hey use this technique. Measuring campaigns in Google analytic enables the attribution of campaigns and traffic sources to user activity within your application. When you download app  from referral link and your download is complete then Play Store app broadcasts an INSTALL_REFERRER intent to your app during installation. After installation of app you get your campaign data in intent.

 

Note: To test the app referral system you have two method one by command and for second one you need to publish your app on google play store.

Step to test live demo

Step 1. Open this link in your mobile device.

Step 2. Install sample app and check

Step 3. After installation complete open and check, you get result like this

Google play campaign android - trinitytuts

To create your own campaign link please follow this link

Follow below step to make thing working

Step 1: Create A new Project in android studio and after your project was created  open build.gradle, add dependencies to it and synchronized your project

Step 2: Now open your AndroidManifest.xml add permission

Step 3: Add the Google Analytics receiver to your AndroidManifest.xml file.

Step 4: Create new java class GoogleAnalyticsApp.java 

Step 5: Create BroadCastReciever InstallReceiver.java

Step 6: Complete Code MainActivity.java

That’s all hope this will help you 🙂 . To check this app is working please install it from google play from above link.