jeduan / cordova-plugin-facebook4

Use the latest Facebook SDK in your Cordova and Ionic projects
Other
767 stars 511 forks source link

getDeferredApplink data is empty #851

Closed sean-browze closed 2 years ago

sean-browze commented 4 years ago

We have Facebook Install Ads that are running off our catalog that has all the necessary deep link attributes. We're having issues getting deferred app link data though when clicking on an ad since updating cordova-plugin-facebook4 from version 4.0.0 to the most recent version. Is anyone else experiencing this? It's specifically an issue with deferred deep linking (user clicking an ad, doesn't have the app, gets redircted to the app store, downloads the app, opens it and the deferred app link data equals "").

facebookConnectPlugin.getDeferredApplink(deeplinkData => {
    console.log(deeplinkData); // equals ""
});

Like I said, this used to work. I did notice the Facebook SDK made a change from >5.0.0 and up:

Starting from v5.0.0, we introduce a flag for disabling automatic SDK initialization. If you follow the GDPR compliance in GDPR Compliance in FB SDK Best Practices for GDPR Compliance re-enable automatic initialization first after an end User provides consent before fetching deferred link:

I'm not entirely sure if this is related though.

Thanks

peterpeterparker commented 4 years ago

Unfortunately I can't answer as I don't use getDeferredApplink sorry.

But can you reproduce the problem with a simple app? Like with the sample repo or any other dummy example you would be able to share, that might help to confirm or not the issue.

onyet commented 3 years ago
facebookSDK() {
    this.fb.getDeferredApplink().then((val) => {
      this.alert.create({
        header: 'Get Deferred App Link',
        message: JSON.stringify(val),
        buttons: [
          {
            text: 'Ok, This is Sample!',
            role: 'cancle'
          }
        ]
      }).then(a => a.present());
    }, (error) => {
      this.alert.create({
        header: 'Get Error Deferred App Link',
        message: JSON.stringify(error),
        buttons: [
          {
            text: 'Ok, This is Sample!',
            role: 'cancle'
          }
        ]
      }).then(a => a.present());
    });
    this.fb.logEvent(this.fb.EVENTS.EVENT_NAME_ADDED_TO_CART);
  }

This is an example of the intended script, and I have found that the result is ""

But you will get results when the application is accessed from the Facebook deeplink. you can try it.

noahcooper commented 2 years ago

This plugin is deprecated. Check out cordova-plugin-facebook-connect at https://www.npmjs.com/package/cordova-plugin-facebook-connect.

To use the getDeferredApplink method on iOS, you must use a plugin such as cordova-plugin-idfa to request ad tracking permission.

For example:

cordova.plugins.idfa.requestPermission().then(function() {
  facebookConnectPlugin.setAdvertiserTrackingEnabled(true);
  facebookConnectPlugin.getDeferredApplink(function(url) {
    console.log('url = ' + url);
  });
});

On Android, no additional plugin is required.