Well, I kept looking for an answer about why my measurement on Google Play is not working. I do not receive any data in my Google Analytics account. Here is what I have:
Google Play Services 6171000 was imported into my project and added as a link.
Google Play App 5.0.38 on my test device
In my res \ xml \ global_tracker.xml file I have:
<?xml version="1.0" encoding="utf-8"?> <resources xmlns:tools="https://schemas.android.com/tools" tools:ignore="TypographyDashes"> <integer name="ga_sessionTimeout">300</integer> <string name="ga_trackingId">MY-TRACKING-ID</string> <bool name="ga_debug">true</bool> <bool name="ga_autoActivityTracking">false</bool> <bool name="ga_reportUncaughtExceptions">true</bool> </resources>
In my manifest, I have:
<uses-permission android:name="android.permission.INTERNET" /> <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
and inside the <application>
I have:
<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> <meta-data android:name="com.google.android.gms.analytics.globalConfigResource" android:resource="@xml/global_tracker" />
Now I used the getTracker method in my extended application class proposed in the Google Analytics setup document, but I donβt think it is necessary to track application downloads. Please correct me if I am mistaken and I will send the code that I have for this.
To test, I tried to run
adb shell am broadcast -a com.android.vending.INSTALL_REFERRER -n com.my.package/com.google.android.gms.analytics.CampaignTrackingReceiver --es "referrer" "utm_source=testSource&utm_medium=testMedium&utm_term=testTerm&utm_content=testContent&utm_campaign=testCampaign"
and I get "Broadcast completed: Result = 0" and then open my application on my device and I get nothing in the campaign logs. Although I read that this is not the right way to test when using V4.
I also packed my application and uploaded it to the Beta section of my store list. When logging into one of my beta tester accounts, I opened the following in my browser and downloaded the application.
https://play.google.com/store/apps/details?id=com.my.package&referrer=utm_source%3DTestSite%26utm_medium%3DsideBanner%26utm_term%3DTestTerm%26utm_content%3DTestContent%26utm_campampaign%3DtestCentaign
This I expect to get some results in the Acquisition-> Google Play Referral section of my Analytics account and do something with testCampaign. I canβt see anything in my account even after 24 hours (not sure what is still required, but I remember that it was for GA).
If anyone knows about a piece that I am missing, or why it does not appear in my account, please point me in the right direction. Thanks.
EDIT:
Here is my tracker code in my extended application class:
private static final String TRACKER_TAG = "GA Tracker"; HashMap<TrackerName, Tracker> mTrackers = new HashMap<TrackerName, Tracker>(); public enum TrackerName { APP_TRACKER // Tracker used only in this app. } synchronized Tracker getTracker(TrackerName trackerEnum) { Log.d(TRACKER_TAG, "Getting GA tracker"); if (!mTrackers.containsKey(trackerEnum)) { Log.d(TRACKER_TAG, "Creating new GA tracker"); GoogleAnalytics analytics = GoogleAnalytics.getInstance(this); analytics.getLogger().setLogLevel(LogLevel.VERBOSE); Tracker t = analytics.newTracker(R.xml.global_tracker); mTrackers.put(trackerEnum, t); } return mTrackers.get(trackerEnum); }