Android Referral Removed In Analytics V3?
I've spent the last two days trying to find a workaround for this. I need to pre-config my app depending on the referral and since google play is broadcasting an Install Referrer i
Solution 1:
I've tried this way. And it does work.( I am also using Google Analytics v3)
First, in manifest :
<!-- Used for Google Play Store Campaign Measurement-->;
<serviceandroid:name="com.google.analytics.tracking.android.CampaignTrackingService" /><receiverandroid:name="com.google.analytics.tracking.android.CampaignTrackingReceiver"android:exported="true" ><intent-filter><actionandroid:name="com.android.vending.INSTALL_REFERRER" /></intent-filter></receiver>
Second, add an CustomReceiver extends BroadcastReceiver ( In my case, I just copy and paste all the codes from developers )
package com.example.testanalytics;
import com.google.analytics.tracking.android.CampaignTrackingReceiver;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
publicclassCustomReceiverextendsBroadcastReceiver
{
@OverridepublicvoidonReceive(Context context, Intent intent)
{
// Pass the intent to other receivers.// When you're done, pass the intent to the Google Analytics receiver.newCampaignTrackingReceiver().onReceive(context, intent);
}
}
last step: in my activity( which I want to send messages to Google Analytics ) create an Intent and call sendBroadcast( Intent ) as follow:
Intent it = new Intent("com.android.vending.INSTALL_REFERRER");
it.setPackage("com.example.testanalytics");
it.putExtra("referrer", "utm_source%3Dyahoo%26utm_medium%3Dbanner+cpc%26utm_term%3Debook%26utm_content%3Dmy_content%26utm_campaign%3Dmy_campaign_name_2");
sendBroadcast(it);
And just get it. I hope this may help you.
Post a Comment for "Android Referral Removed In Analytics V3?"