Add the following permissions to your project's AndroidManifest.xml manifest file:
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
Add the following code snippet to your project's AndroidManifest.xml manifest file:
<!-- Used for install referrer tracking -->
<receiver android:name="com.google.android.apps.analytics.AnalyticsReceiver" android:exported="true">
<intent-filter>
<action android:name="com.android.vending.INSTALL_REFERRER" >
</intent-filter>
</receiver>
But I never entered my UA-xxxxx-yy ID. The ID entered for Pageviews and Events tracking like this:
tracker.startNewSession("UA-xxxxx-yy", this);
Google Analytics for Android SDK ReadMe says: (NOTE: do not start the GoogleAnalyticsTracker in your Application onCreate() method if using referral tracking).
With referrer tracking where do i put my ID or not? If need, how? If not, why?
At first, it seemed strange to me that Google would require those who only need to do install referrer tracking to incorporate two permissions that might otherwise be unneeded, plus a library, into their apps, given that the information needed to track referrers is already available on the Google Play servers, and could presumably be accessed from there via a Web-based interface, similar to the one used to track purchases on the Chrome Web Store. When you consider that the app-based Analytics interface does not even cover purchases via the GP Web pages, the case for doing this seems even more convincing.
This omission still seems odd in the general case of tracking an arbitrary referrer, but I recently discovered that in the specific case where the referrer that you are trying to track comes from an Adwords ad, there seems to be an easier means of tracking Google Play app installs that does not require any modifications to your app. All of this is set up through the Adwords interface, not through Google Play, and not through modifications to your app.
You did not indicate whether your referrers were from Adwords or from some other source or sources, so I'll provide this information, in case it is useful.
This page
http://support.google.com/adwords/bin/answer.py?hl=en&answer=1722054
describes how to set up conversion tracking of Google Play app sales via Adwords. From that page:
Tracking mobile app downloads from Google Play doesn't require adding a code snippet. It can be done with no changes to your app's code. Simply follow the steps below.
Sign in to your AdWords account at http://adwords.google.com
Click the "Tools and Analysis" tab, and then click the "Conversions" tab.
Click the "+ New conversion" button. Name your conversion, select "Mobile app download" and click "Save and continue". Enter the package name. (You can find your package name by looking up your app in Google Play. It's the part of the base URL that identifies your application: "https://play.google.com/store/apps/details?id="
Click "Save and continue".
On the next screen, click "Done".
Your mobile app downloads conversion data will now start showing up with the rest of your conversion data within 24 hours.
Note: Mobile application download tracking for Android will only work if your links in Click-to-download or Mobile App Extension ads point directly to the Google Play Store. Third-party tracking URLs are not supported at this time.