[英]Android Google Analytics Getting Referrer
在Android平台上通過Google Analytics(分析)SDK處理Campaign Measurement(請參閱此處)時,獲取推薦人的最佳方法是什么?
我可以成功地向我的應用程序廣播意圖,並且在日志中看到找到了該廣告系列。 我需要做的是獲取該引薦來源信息並將其發送到我的服務器以進行日志記錄等。當我手動廣播時,我可以在哪里解析此引薦來源並使用它? 當我的應用上線時,我的代碼應該在哪里,以便在安裝時將此引薦來源網址發送到我的服務器?
您可以實現自己的接收器,以從INSTALL_REFERRER
意圖中獲取額外的referral
字符串,進行一些工作,然后將該意圖傳遞給Google Analytics(分析)接收器。
這是一個例子:
package com.example.app;
import com.google.analytics.tracking.android.CampaignTrackingReceiver;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
public class NotePadReceiver extends BroadcastReceiver {
// The name of the referrer string broadcast by Google Play Store.
private static final String PLAY_STORE_REFERRER_KEY = "referrer";
@Override
public void onReceive(Context context, Intent intent) {
String referrer = intent.getStringExtra(PLAY_STORE_REFERRER_KEY);
// Do something with the referrer.
// When you're done, pass the intent to the Google Analytics Campaign Tracking Receiver.
new CampaignTrackingReceiver().onReceive(context, intent);
}
}
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.