Google Play Install Referrer API not providing utm

2019-04-20 00:17发布

问题:

I am using Google Play Install Referrer API 1.0 to collect the install referrer information. The API is providing the utmSource and utmMedium data perfectly, but utmCampaign is completely missing.

I have enabled autoTagging in Google Adwords and the FireBase Analytics is showing the utmCampaign data accurately.

Examples of value returned by :

ReferrerDetails response = mReferrerClient.getInstallReferrer();
response.getInstallReferrer();

is as follows :

utm_source=google-play&utm_medium=organic

utm_source=(not%20set)&utm_medium=(not%20set)

I am wondering why utmCampaign data is missing.

Anyone faced similar issue and has any solution? It is critical to find out the Campaign source information for us.

回答1:

Try this:

FirebaseDynamicLinks.getInstance().getDynamicLink(getActivity().getIntent())
        .addOnSuccessListener(getActivity(), new OnSuccessListener<PendingDynamicLinkData>() {
            @Override
            public void onSuccess(PendingDynamicLinkData pendingDynamicLinkData) {
                // Get deep link from result (may be null if no link is found)
                if (pendingDynamicLinkData != null) {
                    //utm_campaign=cam&utm_medium=cpc&utm_source=xyz
                    Uri deepLink = pendingDynamicLinkData.getLink();
                    if (deepLink.toString().contains("utm_campaign") ||
                            deepLink.toString().contains("utm_medium") ||
                            deepLink.toString().contains("utm_source")) {
                    }
                }
            }
        })
        .addOnFailureListener(getActivity(), new OnFailureListener() {
            @Override
            public void onFailure(@NonNull Exception e) {
            }
        });