【问题标题】:Install referrer is not tracking on android web market安装引荐来源网址未在 android 网络市场上跟踪
【发布时间】:2012-04-21 18:46:30
【问题描述】:

通过手机上的电子市场应用安装应用时,应用将正确接收传递给它的推荐人信息(如下所述:http://code.google.com/mobile/analytics/docs/android/#android-market-tracking)。

但是,当通过基于网络的电子市场安装具有相同引荐来源的相同应用时,引荐来源信息会被丢弃,并且不会被应用接收。这使得从网络上针对您的应用程序的广告系列无法跟踪。

是否可以通过 android 网络市场跟踪安装引荐来源网址?

【问题讨论】:

    标签: android installation referrer


    【解决方案1】:

    不,无法从基于网络的 Google Play 商店跟踪安装引荐来源网址。这是a known issue with the latest SDK

    Google Play 广告系列跟踪目前不支持网络到设备 从网络 Play 商店启动的安装。

    【讨论】:

    • 文档链接和“已知问题”部分适用于旧版 v2。从以后的版本中,整个“已知问题”部分都丢失了。那么,该功能现在应该工作吗?对我来说,似乎没有,即原来的“没有通过网络市场推荐人”的问题仍然存在。
    【解决方案2】:

    这里可能有点晚了。幸运的是,这有助于我们跟踪来自网上商店的安装。

    接收器类:

    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
        }
    };
    

    接收数据的方法:

     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 上得到了这个善良灵魂的大部分帮助

    【讨论】:

    猜你喜欢
    • 2011-11-21
    • 1970-01-01
    • 1970-01-01
    • 2019-09-30
    • 2018-10-14
    • 2020-01-23
    • 1970-01-01
    • 2012-06-29
    • 1970-01-01
    相关资源
    最近更新 更多