最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

android - Flutter Install Referrer Not Capturing UTM Parameters from Google Ads - Stack Overflow

programmeradmin4浏览0评论

Title Flutter Install Referrer Not Capturing UTM Parameters from Google Ads

Question
I'm implementing Google Play Install Referrer in my Flutter app to capture UTM parameters when a user installs the app via a Google Ads link.

What I'm Trying to Achieve
When a user clicks on a Google Ads link and installs the app from the Play Store, I want to capture UTM parameters (utm_source, utm_medium, utm_campaign) inside my app.

What I've Done So Far

1. Used the android_play_install_referrer package

dependencies:
  android_play_install_referrer: ^0.4.0

2. Added the required receiver in AndroidManifest.xml

<receiver
    android:name="com.android.installreferrer.api.InstallReferrerReceiver"
    android:exported="true">
    <intent-filter>
        <action android:name="com.android.vending.INSTALL_REFERRER" />
    </intent-filter>
</receiver>

3. Fetching the install referrer inside my app

Future<void> initReferrerDetails() async {
  try {
    ReferrerDetails referrerDetails = await AndroidPlayInstallReferrer.installReferrer;
    String referrerDetailsString = referrerDetails.installReferrer.toString();
    
    print("Referrer Details: $referrerDetailsString");

    // Decode and parse the UTM parameters
    String decodedReferrer = Uri.decodeComponent(referrerDetailsString);
    Map<String, String> queryParams = Uri.splitQueryString(decodedReferrer);

    print("utm_source: ${queryParams["utm_source"] ?? 'Not found'}");
    print("utm_campaign: ${queryParams["utm_campaign"] ?? 'Not found'}");
    print("utm_medium: ${queryParams["utm_medium"] ?? 'Not found'}");
  } catch (e) {
    print("Failed to get referrer details: $e");
  }
}

4. Triggering initReferrerDetails() on the sign-up page
I call this function when the user reaches the sign-up screen. Issue I'm Facing

1️⃣ When I install the app manually (debug build), the output is:

Referrer Details: utm_source=google-play&utm_medium=anic

2️⃣ When I click a Google Ads link → go to Play Store → install the app, the output is:

Referrer Details: utm_source=(not%20set)&utm_medium=(not%20set)

The UTM parameters from Google Ads are not being captured.
What I've Tried to Fix It
✅ Ensured that the app was installed from the Play Store (not manually).
✅ Verified that the Google Ads link contains correct UTM parameters.
✅ Waited a few minutes before fetching install referrer data.
✅ Checked the receiver configuration in AndroidManifest.xml.

Questions

  1. Why is my install referrer returning utm_source=(not set) instead of actual Google Ads data?
  2. Is there a proper way to test Google Ads UTM tracking in a debug or internal build?
  3. Are there any Google Ads campaign settings that might prevent UTM data from being passed?
发布评论

评论列表(0)

  1. 暂无评论