taraloca
taraloca

Reputation: 9135

Retrieving all Campaign Parameter appended to GooglePlay URL

I found this script to test Google Campaign Parameters received:

adb shell am broadcast -a com.android.vending.INSTALL_REFERRER -n com.accuweather.android/com.accuweather.android.services.GoogleCampaignTrackingReceiver --es "referrer" "utm_source=test_androidlite_source&utm_medium=test_medium&utm_term=test_term&utm_content=test_content&utm_campaign=test_name"

Found here

Here is how I am receiving it for testing purposes:

public class GoogleCampaignTrackingReceiver extends BroadcastReceiver {

    @Override
    public void onReceive(Context context, Intent intent) {
        Bundle extras = intent.getExtras();
        String referrerString = extras.getString("referrer");

        Logger.i(this, "referrer string is %s", referrerString);
}
}

And I am wondering how I get all the parameters, not just the first? Here is the log statement:

03-13 18:40:41.990: I/GoogleCampaignTrackingReceiver(30212): referrer string is utm_source=test_androidlite_source

Upvotes: 3

Views: 493

Answers (1)

Dehimb
Dehimb

Reputation: 352

I'm faced same issue and spend couple hours to find the answer. In my case, i send broadcast

./adb shell am broadcast -a com.android.vending.INSTALL_REFERRER --es "referrer" "traffic=test1&md=1t1&utm_source=test1&utm_medium=android&utm_campaign=test12&utm_term=t3&utm_content=t5

And got only first param

Solution is simple - you need enter the adb shell first

./adb shell

And then send your broadcast

shell@android:/ $ am broadcast -a com.android.vending.INSTALL_REFERRER --es "referrer" "traffic=test1&md=1t1&utm_source=test1&utm_medium=android&utm_campaign=test12&utm_term=t3&utm_content=t5

All params will be received correctly. I hope it will be useful, since i have not find such explanations

Upvotes: 2

Related Questions