通过手机上的Market应用安装应用时,应用会正确接收传递给它的推荐人信息(如下所述:http://code.google.com/mobile/analytics/docs/android/#android-market-tracking)。
但是,当通过基于网络的市场使用相同的引荐来源安装相同的应用程序时,引用者信息将被删除,应用程序不会收到该信息。这样,无法跟踪从网络定位您的应用的广告系列。
是否可以通过Android网络市场跟踪安装引荐来源?
答案 0 :(得分:6)
不,无法从基于网络的Google Play商店跟踪安装引荐来源。这是a known issue with the latest SDK。
Google Play广告系列跟踪目前不支持网络到设备 从网上Play商店发起的安装。
答案 1 :(得分:0)
可能有点晚了。幸运的是,这可以帮助我们跟踪来自网上商店的安装。
接收器类:
public class OwnReceiver extends BroadcastReceiver {
public static final String ACTION_UPDATE_DATA = "ACTION_UPDATE_DATA";
private static final String ACTION_INSTALL_REFERRER = "com.android.vending.INSTALL_REFERRER";
private static final String KEY_REFERRER = "referrer";
public OwnReceiver() {
}
@Override
public void onReceive(Context context, Intent intent) {
if (intent == null) {
Log.e("ReferrerReceiver", "Intent is null");
return;
}
if (!ACTION_INSTALL_REFERRER.equals(intent.getAction())) {
Log.e("ReferrerReceiver", "Wrong action! Expected: " + ACTION_INSTALL_REFERRER + " but was: " + intent.getAction());
return;
}
Bundle extras = intent.getExtras();
if (intent.getExtras() == null) {
Log.e("ReferrerReceiver", "No data in intent");
return;
}
MyApplication.setReferrerDate(context.getApplicationContext(), new Date().getTime());
//Contro.setReferrerData(context.getApplicationContext(), (String) extras.get(KEY_REFERRER));
MyApplication.setReferrerData(context.getApplicationContext(), (String) extras.get(KEY_REFERRER));
LocalBroadcastManager.getInstance(context).sendBroadcast(new Intent(ACTION_UPDATE_DATA));
}
}
在MainActivity中的用法:
private final BroadcastReceiver mUpdateReceiver = new BroadcastReceiver() {
@Override
public void onReceive(Context context, Intent intent) {
someMethod(); //send received data to your method and use it your way
}
};
someMethod您接收数据的地方:
private void someMethod(){
String referrerDataRaw = MyApplication.getReferrerDataRaw(getApplicationContext());
if(referrerDataRaw.toLowerCase().contains(matchx.toLowerCase())){
Log.i("true",referrerDataRaw);
Toast.makeText(getBaseContext(),"Install referrer found",Toast.LENGTH_SHORT).show();
//postBack();
}
else {
Log.i("false","no referrer found");
Toast.makeText(getBaseContext(),"no referrer found",Toast.LENGTH_SHORT).show();
}
}
奖励如果您要发送回发
,请执行此操作public void postBack() {
// String postTest = "https://play.google.com/store/apps/details?id=com.neon.myApp&referrer=utm_source=someOne&utm_medium=cpr&utm_term=testytest";
String referrerDataRaw = MyApplication.getReferrerDataRaw(getApplicationContext());
// Toast.makeText(this, "raw : " + postTest, Toast.LENGTH_SHORT).show();
String[] split = referrerDataRaw.split("=");
String end = split[split.length - 1];
Toast.makeText(this, AppConstant.lin + end, Toast.LENGTH_SHORT).show();
StringRequest strReq = new StringRequest(Request.Method.POST,
AppConstant.lin + end, new Response.Listener<String>() {
@Override
public void onResponse(String response) {
Toast.makeText(getBaseContext(),"postback sent",Toast.LENGTH_SHORT).show();
}
}, new Response.ErrorListener() {
@Override
public void onErrorResponse(VolleyError error) {
}
});
// Adding request to request queue
MyApplication.getInstance().addToRequestQueue(strReq, tag_string_req);
}
在github https://github.com/SimonMarquis/Android-InstallReferrer
上获得了这种灵魂的大部分帮助