admin管理员组

文章数量:1124376

Summary

Link click tracking is not working on iOS with @config-plugins/react-native-branch.

We are implementing a customer referral system using Branch.io, where app users can invite others using an invitation link. To configure the link, we followed the basic configuration described in the plugin project's README and consulted some community issues for additional insights.

We configured Branch.io as shown in the screenshots below:

In iOS, in Apple Developer, we enabled the "Associated Domains" option in the App ID configuration and confirmed other information, such as the Bundle Identifier and Apple App Prefix.

In the app, we use the plugin in two scenarios:

  1. We created a component that initializes branchUniversalObjectParams to generate the share link, including the user's code. This is working correctly.
  2. In the main route of the app, we check the link using branch.getLatestReferringParams(). The flow works correctly on Android. However, on iOS, the data returned is empty.

For example, when a new user clicks on the link and downloads the app from the AppStore, the received data is empty.

When a new user click on Googleplay:

Now, I will show how the plugin was implemented in the app's entry route and other relevant information:

useEffect(() => {
    const fetchAndStoreReferralParams = async () => {
        try {
            const params = await branch.getLatestReferringParams();

            registerLogs({ params });

            if (params?.referralId) {
                await storage.create("REFERRAL_USER_ID", params.referralId as string);
            }
        } catch (error) {
            // Error handling
        }
    };

    fetchAndStoreReferralParams();
}, []);

In the app.config.ts file:

ios: {
    bundleIdentifier: "br.smartsave",
    googleServicesFile: process.env.APPLE_SERVICES_JSON,
    associatedDomains: [
        "applinks:smartsave.app.link",
        "applinks:smartsave-alternate.app.link",
    ],
},
name: "SmartSave",
scheme: "smartsave",
android: {
    package: "br.smartsave",
    googleServicesFile: process.env.GOOGLE_SERVICES_iOS,
},
plugins: [
    [
        "@config-plugins/react-native-branch",
        {
            apiKey: process.env.BRANCHIO_APIKEY,
            iosAppDomain: "smartsave.app.link",
        },
    ],
],`

Versions used:

"expo": "^51.0.38",
"react-native-branch": "^6.2.1",
 "@config-plugins/react-native-branch": "^8.0.0",
 "react": "18.2.0",
 "react-native": "0.74.5"

Thank you for any help :)

本文标签: iOS Deep Linking Issue with Branchioreactnativebranch IntegrationStack Overflow