调整反应本机重新归因vie深层链接不起作用

时间:2019-10-19 07:59:33

标签: react-native deeplink

我正在我的本机应用程序上设置Adjust metrica。我设法使深层链接打开了我的应用程序。在每个深度链接打开应用后,应重新分配该应用,但不会发生。

我多次检查了文档,并按照它的感觉做了所有事情。链接方法捕获URL,并且应将其提供给Adjust.appWillOpenUrl

constructor(props) {
    super(props);
    Adjust.getSdkVersion(function (sdkVersion) {
        console.log("Adjust SDK version: " + sdkVersion);
    });

    const adjustConfig = new AdjustConfig("KEY", AdjustConfig.EnvironmentSandbox);
    adjustConfig.setLogLevel(AdjustConfig.LogLevelVerbose);
    adjustConfig.setShouldLaunchDeeplink(true);
    adjustConfig.setSendInBackground(true);

    adjustConfig.setDelayStart(4.0);

    adjustConfig.setAttributionCallbackListener(function (attribution) {
        console.log(">>> Attribution callback received");

        console.log("Tracker token = " + attribution.trackerToken);
        console.log("Tracker name = " + attribution.trackerName);
        console.log("Network = " + attribution.network);
        console.log("Campaign = " + attribution.campaign);
        console.log("Adgroup = " + attribution.adgroup);
        console.log("Creative = " + attribution.creative);
        console.log("Click label = " + attribution.clickLabel);
        console.log("Adid = " + attribution.adid);
    });

    adjustConfig.setDeferredDeeplinkCallbackListener(function(deeplink) {
        console.log("Deferred deep link URL content: " + deeplink);
    });


    adjustConfig.setDelayStart(4.0);

    Adjust.addSessionCallbackParameter("New session");

    Adjust.create(adjustConfig);
}

_trackFormSentEvent() {
    const adjustEvent = new AdjustEvent("KEY");
    Adjust.trackEvent(adjustEvent);
}

_trackNewSessionEvent() {
    const adjustEvent = new AdjustEvent("KEY");

    Adjust.trackEvent(adjustEvent);
}

async componentDidMount() {
    await this._trackNewSessionEvent();
    const value = await AsyncStorage.getItem('REQUESTSENT');
    if (value) this.setState({requestSent: true});

    Linking.addEventListener('url', this.handleDeepLink);
    Linking.getInitialURL().then((url) => {
        if (url) {
            this.handleDeepLink({ url });
        }
    })

}

componentWillUnmount() {
    Linking.removeEventListener('url', this.handleDeepLink);
}

handleDeepLink(event) {
    Adjust.appWillOpenUrl(event.url);
}

0 个答案:

没有答案
相关问题