安装Referrer Library是否返回数据utm_source =(not%20set)&utm_medium =(not%20set)?如何获取网址中提到的确切参数?

时间:2018-11-22 19:28:29

标签: android google-play deeplink install-referrer

Google在哪种情况下会返回utm_source =(not%20set)&utm_medium =(not%20set)的这种格式。

请让我知道是否有任何文档可以检查代码是否工作正常?

使用新的Google推荐API。

try {
            mReferrerClient = InstallReferrerClient.newBuilder(this).build();
            mReferrerClient.startConnection(new InstallReferrerStateListener() {
                @Override
                public void onInstallReferrerSetupFinished(int responseCode) {
                    switch (responseCode) {
                        case InstallReferrerClient.InstallReferrerResponse.OK:
                            // Connection established

                            ReferrerDetails response = null;
                            try {
                                response = mReferrerClient.getInstallReferrer();

                                refer = response.getInstallReferrer();

                                setData(refer, intent);

                                Log.e("refergoogle", refer);
                                response.getReferrerClickTimestampSeconds();
                                response.getInstallBeginTimestampSeconds();
                                mReferrerClient.endConnection();


                            } catch (Exception e) {
                                Crashlytics.logException(e);
                            }
                            break;
                        case InstallReferrerClient.InstallReferrerResponse.FEATURE_NOT_SUPPORTED:
                            // API not available on the current Play Store app
                            break;
                        case InstallReferrerClient.InstallReferrerResponse.SERVICE_UNAVAILABLE:
                            // Connection could not be established
                            break;
                    }
                }

                @Override
                public void onInstallReferrerServiceDisconnected() {
                    // Try to restart the connection on the next request to
                    // Google Play by calling the startConnection() method.
                }
            });
        } catch (Exception e) {
            Crashlytics.logException(e);
        }

为实时应用打印的日志为E /原始档:utm_source =(not%20set)&utm_medium =(not%20set)

2 个答案:

答案 0 :(得分:0)

您的代码没有任何问题,问题在于您正在测试的方式。看看这个答案:https://stackoverflow.com/a/54884659/2443123

您需要首次使用具有引荐来源网址的另一个Google帐户进行测试。

答案 1 :(得分:0)

根据我的观察,“未设置”通常发生在通过 Facebook 安装的情况下。