thebergamo / react-native-fbsdk-next

MIT License
633 stars 165 forks source link

Full setup for android/ios app-install events with Expo #493

Closed marecikl closed 2 days ago

marecikl commented 2 months ago

I want to use this SDK for reporting app-install events. What is a FULL working setup compatible with google/apple policies? Can anyone share his approach? I know that there are some hints how to do it in the project description, but I miss crucial details which flag should be set on iOS and which not.

My proposition:

Setup for Android: No need to ask a user for permissions, just collect the data:

{
  "expo": {
    "plugins": [
      [
        "react-native-fbsdk-next",
        {
          "appID": "XXXXXXXXX",
          "clientToken": "YYYYYYYY",
          "displayName": "ZZZZZZ",
          "scheme": "fbXXXXXXXXX",
          "advertiserIDCollectionEnabled": true,
          "autoLogAppEventsEnabled": true,
          "isAutoInitEnabled": true,
          "iosUserTrackingPermission": "This identifier will be used to deliver personalized ads to you."
        }
      ]
    ]
  }
}

Setup for iOS. Ask before collecting data:

{
  "expo": {
    "plugins": [
      [
        "react-native-fbsdk-next",
        {
          "appID": "XXXXXXXXX",
          "clientToken": "YYYYYYYY",
          "displayName": "ZZZZZZ",
          "scheme": "fbXXXXXXXXX",
          "advertiserIDCollectionEnabled": false,
          "autoLogAppEventsEnabled": true,
          "isAutoInitEnabled": false,
          "iosUserTrackingPermission": "This identifier will be used to deliver personalized ads to you."
        }
      ]
    ]
  }
}

and then during app initialization:

import { requestTrackingPermissionsAsync } from 'expo-tracking-transparency';

const { status } = await requestTrackingPermissionsAsync(); 

Settings.initializeSDK();

if (status === 'granted') {
    await Settings.setAdvertiserTrackingEnabled(true);
}

Are those approach correct? And can I somehow unifiy them?

p.s. And the deeper question: what happend for iOS when permission is denied by the user? Are the events still send to FB, but without advertiser-id?

mikehardy commented 2 months ago

I don't think this repository is active enough for anyone to do this work for you. To set expectations, if I needed this I would have the expectation that I would personally have to try everything with careful experiments carefully logging results. Then if you proposed a PR to the documentation or made a blog post or similar you'd help others, but I would not expect anyone to come through here and answer the questions

Not intending to be irritating or anything, just trying to set reasonable expectations based on repo activity level. If I'm wrong and someone answers, awesome.

marecikl commented 2 months ago

I decided to ask here, because:

Don't get me wrong, if I have to, I will do reverse engineering and send my app multiple times for AppStore to figure out which approach really works, but it seems to be a long process and maybe instead I will be lucky and someone will read this topic and share working settings from his project.

mikehardy commented 2 months ago

That all makes sense. It doesn't sound easy. Regardless, I believe my attempt to set expectations is valid. You will likely have to be the person blazing the path into the frontier here and documenting findings. It would be excellent if I were proven wrong, but I didn't want someone (you, in this case) to have incorrect expectations that this package was heavily used and had a vibrant community of people sharing knowledge since it doesn't. It is used. It seems to work fine once people do all the necessary things, but it's pretty quiet around here...not many people helping each other out.

julian-gargicevich commented 2 months ago

I have an almost identical setup as you and I've been struggling to get everything to work in Europe. US works fine but my Europe campaigns don't track purchases, they do track installs though.

hgeorgilas commented 1 month ago

@julian-gargicevich Did you manage to find a way? I'm also facing a similar issue, the App events are being displayed as expected, but not all events are displayed in the ads manager dashboard.

julian-gargicevich commented 1 month ago

@julian-gargicevich Did you manage to find a way? I'm also facing a similar issue, the App events are being displayed as expected, but not all events are displayed in the ads manager dashboard.

FB ads just stucks tbh, it's so hard to test when half the time their platform is not working correctly. One week you get warnings from not having the latest sdk, next week everything works fine, next one all purchases are gone, next one some other event is missing. So frustrating.

I ended up swallowing the bullet and getting an MMP (branch.io), it gets the job done and it also allows us to do TikTok as well. I'll come back to this whenever tiktok publish their own SDK

stale[bot] commented 1 week ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.