我找到了这个脚本来测试收到的 Google 广告系列参数:
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"
以下是我出于测试目的接收它的方式:
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);
}
}
我想知道如何获得所有参数,而不仅仅是第一个?这是日志语句:
03-13 18:40:41.990: I/GoogleCampaignTrackingReceiver(30212): referrer string is utm_source=test_androidlite_source