Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Campaign Measurement with own BroadcastReceiver

I've an Android app where user has to register. On sending registration, I want to send the parameters from the PlayStore (utm_source, etc.) to know from which campaign user comes from.

So the idea was to use a own BroadcastReceiver for INSTALL_REFERRER, where I save parameters to a file. When user registers i will read the file and send the content.

So I made receiver:

public class CampaignBroadcastReceiver extends BroadcastReceiver {
@Override
public void onReceive(Context context, Intent intent) {


    String refferer = intent.getExtras().getString("referrer");
    try {
        FileOutputStream fos = context.openFileOutput("campaign", Context.MODE_PRIVATE);
        fos.write(refferer.getBytes());
        fos.close();
    } catch (FileNotFoundException e) {

    } catch (IOException e) {

    }


    new CampaignTrackingReceiver().onReceive(context, intent);
}

And, in AndroidManifest.xml I use :

<service android:name="com.google.analytics.tracking.android.CampaignTrackingService"/>
    <receiver android:name=".receiver.CampaignBroadcastReceiver" android:exported="true">
        <intent-filter>
            <action android:name="com.android.vending.INSTALL_REFERRER" />
        </intent-filter>
    </receiver>

When i use the test scenario from google it works and the onReceive Method in my BroadcastReceiver is called.

./adb shell am  broadcast -a com.android.vending.INSTALL_REFERRER -n
mypackage/mypackage.receiver.CampaignBroadcastReceiver --es  "referrer" 
"utm_source%3Dtest%26utm_medium%3Dbanner%26utm_term%3Dmailstuff"

But, when I try it from PlayStore then nothing is called.

Has anybody idea how to grap the campaign parameters from the PlayStore in app?

like image 465
user2641233 Avatar asked Aug 01 '13 08:08

user2641233


1 Answers

I don't know a workaround but the issue is known to Google.

Google Play Campaign Measurement does not currently support web-to-device installs initiated from the web Play Store.

Known Issues

like image 185
Benny Avatar answered Oct 14 '22 14:10

Benny