使用Install Referrer获取(not%20set)UTM参数-Android [英] Getting (not%20set) for UTM parameters with Install Referrer- Android

查看:260
本文介绍了使用Install Referrer获取(not%20set)UTM参数-Android的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用我的自定义广播接收器来跟踪UTM参数.

I am using my custom broadcast receiver as follows to track UTM parameters.

 <receiver
    android:name=".services.CustomInstallListener" 
android:exported="true">
    <intent-filter>
      <action android:name="com.android.vending.INSTALL_REFERRER" />
    </intent-filter>
</receiver>

 public class CustomInstallListener extends BroadcastReceiver {
    @Override
    public void onReceive(Context context, Intent intent) {
      if (intent.hasExtra("referrer")) {
       String data = intent.getStringExtra("referrer");
       String referrers[] = data.split("&");
       for (String referrerValue : referrers) {
         String keyValue[] = referrerValue.split("=");
         if (keyValue.length > 0) {
          if (keyValue[0].equalsIgnoreCase("utm_campaign")) {
            ... something                    
          }
        }
      }
  }

我还按如下方式实现了 InstallReferralClient

I have also implemented the InstallReferralClient as follows

referrerClient.startConnection(new InstallReferrerStateListener() {
@Override 
public void onInstallReferrerSetupFinished(int responseCode) {
   switch (responseCode) {
    case InstallReferrerClient.InstallReferrerResponse.OK:      
     ReferrerDetails response = null;
     try {
      response = referrerClient.getInstallReferrer();
     } catch (RemoteException e) {
       e.printStackTrace();
     }
   }
}
@Override
public void onInstallReferrerServiceDisconnected() {
}
});

我使用了 Google Play网址构建器来生成这个网址.

And I used the Google Play Url Builder to generate this URL.

现在,我已经尝试使用HTTP和https URL,并在StackOverflow上遇到了其他一些问题之后尝试了其他解决方案,但是似乎没有任何效果.

Now I have it tried with both HTTP and https URLs and tried some other solutions following some other questions on StackOverflow but nothing seems to work.

Link1 Link2 对于在URL中传递的所有要播放商店的UTM参数,我得到的是(不是%20set).我还尝试在分支 firebase动态链接的深层链接中使用URL,但遇到相同的错误.

For all the UTM parameters passed in the URL to play store, I am getting (not%20set) as value. I have also tried using the URL in the deep link from the branch and firebase dynamic links and I am getting the same error.

但是我确定处理此问题的代码是正确的,因为直接从Play商店直接安装时,它分别将广告系列和中等价值分别返回为 Google organic .

But I am sure that the code to handle this is correct as it returns campaign and medium value as Google and organic respectively when directly installing from Play Store.

推荐答案

您最有可能登录到托管帐户(例如工作电子邮件).您是否在Play商店中激活了个人帐户都没关系. Play商店会持续检查您在该手机上登录的所有帐户.如果它们中的任何一个由企业管理,它将重置引荐来源令牌.您可以通过删除该帐户并重试发送令牌来进行验证.

You're most likely logged into a managed account (e.g. a work email). It doesn't matter if you have your personal account active in Play Store. The Play Store consistently checks all accounts that you're signed into on that phone. If any of them are managed by an enterprise that it resets the referrer token. You can verify this by removing said account and retry sending the token.

我不能和为什么说话,但这也许是谷歌的某个人可以照亮的.

I can't speak to why this is the intended behavior but perhaps someone from Google can shine some light.

这篇关于使用Install Referrer获取(not%20set)UTM参数-Android的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆