问题描述
Play Install Referrer 库无法通过自动标记从 Google Ads 获取 UTM 标记
我正在尝试从我的应用代码中的安装引用链接获取 UTM 标签。但是 Play Install Referrer 库 (v 2.1) 总是返回 utm_source 'not-set' 对于来自具有自动标签设置的谷歌广告活动的安装。不过,我可以在 Google Analytics 和 Firebase Analytics 控制台中查看有关我的应用安装转化的信息。
现在在我的应用程序中,我可以通过 Play Install Referrer 库从 Google Ads 广告系列中获得:utm_source=(not%20set)&utm_medium=(not%20set)
我需要从我的应用代码中的 Google Ads 广告系列中获取有关我的应用 first_open 事件和归因 UTM 标签的信息。我怎样才能做到这一点?
这是我的代码清单:
static public void getinstallreferrer(Activity activity) {
installreferrerClient referrerClient = installreferrerClient.newBuilder(activity).build();
Log.d(TAG,"-----------> getinstallreferrer()");
referrerClient.startConnection(new installreferrerStateListener() {
@Override
public void oninstallreferrerSetupFinished(int responseCode) {
Log.d(TAG,"-------------> oninstallreferrerSetupFinished()");
switch (responseCode) {
case installreferrerClient.installreferrerResponse.OK:
Log.d(TAG,"------------------------> installreferrerResponse.OK");
try {
ReferrerDetails response = referrerClient.getinstallreferrer();
String referrerUrl = response.getinstallreferrer();
// set referrer data:
AppPreferences.getInstance().setinstallreferrerLink(referrerUrl);
} catch (remoteexception e) {
e.printstacktrace();
}
referrerClient.endConnection();
break;
case installreferrerClient.installreferrerResponse.FEATURE_NOT_SUPPORTED:
Log.d(TAG,"------------------------> installreferrerResponse.FEATURE_NOT_SUPPORTED");
break;
case installreferrerClient.installreferrerResponse.SERVICE_UNAVAILABLE:
Log.d(TAG,"------------------------> installreferrerResponse.SERVICE_UNAVAILABLE");
break;
case installreferrerClient.installreferrerResponse.DEVELOPER_ERROR:
Log.d(TAG,"------------------------> installreferrerResponse.DEVELOPER_ERROR");
break;
case installreferrerClient.installreferrerResponse.SERVICE_disCONNECTED:
Log.d(TAG,"------------------------> installreferrerResponse.SERVICE_disCONNECTED");
break;
}
}
@Override
public void oninstallreferrerServicedisconnected() {
// Try to restart the connection on the next request to
// Google Play by calling the startConnection() method.
}
});
}
在我的 SplashActivity onCreate() 方法中,我称之为:
AttributionHelper.getinstallreferrer(this);
P.S:此代码在我们应用的发布版本上进行了测试,对于来自 Google Ads 广告系列的用户,我们仅在 UTM 标签中获得了“not-set”值。
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)