I started to Implement Campaign Measurement with Google Analytics V4 referring the link https://developers.google.com/analytics/devguides/collection/android/v4/ . Facing an issue when Tested Campign Measurement as mentioned in https://developers.google.com/analytics/solutions/testing-play-campaigns. Every time my logs showing "No Campaign data found"
I imported google Play services (Rev :18) in to my workspace and referred it in my project
Added below lines in my Manifest file
<uses-permission android:name="android.permission.INTERNET"></uses-permission>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"></uses-permission>
<meta-data android:name="com.google.android.gms.version"
android:value="@integer/google_play_services_version" />
<meta-data android:name="com.google.android.gms.analytics.globalConfigResource"
android:resource="@xml/global_tracker" />
and also below code
<service android:name="com.google.android.gms.analytics.CampaignTrackingService"/>
<receiver android:name="com.google.android.gms.analytics.CampaignTrackingReceiver"
android:exported="true">
<intent-filter>
<action android:name="com.android.vending.INSTALL_REFERRER" />
</intent-filter>
</receiver>
later created global_tracker.xml file under res->xml. Below is my xml file
<?xml version="1.0" encoding="utf-8" ?>
<resources xmlns:tools="http://schemas.android.com/tools"
tools:ignore="TypographyDashes"
>
<integer name="ga_sessionTimeout">300</integer>
<!-- Enable automatic Activity measurement -->
<bool name="ga_autoActivityTracking">true</bool>
<bool name="ga_debug">true</bool>
<string name="ga_logLevel">verbose</string>
<string name="ga_dryrun">true</string>
<!-- The screen names that will appear in reports -->
<!-- The following value should be replaced with correct property id. -->
<string name="ga_trackingId">UA-xxxxxxx-1</string>
</resources>
replaced Tracking Id with my tracking id
while testing campaign measurement, i first installed my app on to my device (Moto G (4.4.2)) through adb install. Made sure the app is not running and broadcasted the intent as mentioned in the above Link . i got success log when broadcasted the intent.
Intent
E:\xxxxxxx\adt-bundle-windows-x86_64-20140321\sdk\platform-tools
>adb shell am broadcast -a com.android.vending.INSTALL_REFERRER -n <My Package name>/com.google.android.gms.analytics.CampaignTrackingReceiver --es "referrer" "utm_source=testsource"
Response:
Broadcasting: Intent { act=com.android.vending.INSTALL_REFERRER cmp=<My Package name>
>/com.google.android.gms.analytics.CampaignTrackingReceiver (has extras) }
Broadcast completed: result=0
When i opened my application i always got " I/GAV2(7342): Thread[GAThread,5,main]: No campaign data found." error in my logs.
Can please someone let me know why am i not getting Campaign data ? where i am going wrong.
Also, why it is Showing "GAV2" in logs when i am using GAV4
GA Logs:
07-09 12:59:26.542: W/GAV2(20502): Thread[main,5,main]: Need to call initialize() and be in fallback mode to start dispatch.
07-09 12:59:31.568: I/GAV2(20502): Thread[GAThread,5,main]: No campaign data found.
Note: This is the first time i am working with Google Analytics. As i want to check whether i am receiving Campaign data or not first, i didn't implemented any trackers to GA
Edit : When i manually trigger the Broadcast intent on button click in my App. I am able to see "Campaign found" log when i restarted my app. But the same not happening when triggered intent using "adb shell" command as mentioned above. I doubt may be intent is not reaching to my device . Is there any way to find whether the intent is received or not ?
Please help