Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Facebook App Events not working #273

Closed
squirrelhomie opened this issue Jun 20, 2022 · 27 comments
Closed

Facebook App Events not working #273

squirrelhomie opened this issue Jun 20, 2022 · 27 comments
Labels
wontfix This will not be worked on

Comments

@squirrelhomie
Copy link

squirrelhomie commented Jun 20, 2022

🐛 Bug Report

We are having a lot of trouble implementing the FB SDK and optimizing our Facebook campaigns for App Installs and are looking for any guidance possible.

We have added react-native-fbsdk-next to our app and followed instructions for both iOS and Android. We confirmed App Events are being sent to Facebook:

Screen Shot 2022-06-20 at 8 06 58 AM

However, when we attempt to create a campaign that optimizes for App Installs in Facebook, we contioustly receive this error:

Screen Shot 2022-06-16 at 3 57 22 PM

We spoke over the weekend for hours with Facebook Support via chat and their reply has been consistent that:

Our team has reviewed our case and has found that the ad can't be optimized for app installs because the app haven't received any app activation events / standard app events from their app.

To prove the point even more, our Facebook App received more events this morning for App Installs:

Screen Shot 2022-06-20 at 8 06 38 AM

But we continue to receive the same message from Facebook.

So now, our next thought is possibly there is a bug in react-native-fbsdk-next or missing documentation on how to set this up correctly in Facebook Business Manager for App Install optimization.

To Reproduce

  • Install react-native-fbsdk-next 8.0.5 (npm and pods)
  • Follow set up guide https://www.npmjs.com/package/react-native-fbsdk-next
  • Deploy to the App Store
  • Set up App and Ad Account in Facebook Business Manager
  • In Facebook Business Manager, attempt to create a campaign optimized for App Installs
  • Select your App in the App Store
  • Then receive this error:

To optimize for app installs, app events or value, your ad account must be connected to the same business as the app and must be a connected asset of the app. You can complete these steps in Business Manager.

Expected Behavior

App Events should be successfully sent to Facebook to allow us to create an App Install optimized campaign

Environment

Production

I understand that this may be a little vague or not super clear whether this is a bug in react-native-fbsdk-next, with us, or with Facebook. At the very least, a sanity check would be helpful. When Facbeook is telling us that the app is not receiving events, but we can clearly see the events, it's making us feel like we're kind of going crazy.

If anyone can provide any guidance on this, we would greatly appreciate it! Also, if there is a better community space to post this, please let me know. Want to make sure we don't clog up the issue pipeline for this project if this isn't the right space. Thanks!

@mikehardy
Copy link
Collaborator

It doesn't seem vague or unclear, but my problem (as I guess the only maintainer currently active at the moment) is that this is not a use case of mine at all - I have no experience with app events or install optimization etc, so I can't serve as a sanity check. I recognize that's not directly helpful, but if it helps to set (or, unset?) expectations perhaps that's useful, as far as it goes. Apologies

@squirrelhomie
Copy link
Author

@mikehardy No worries, thanks so much for the response! I understand that the Facebook specific use cases might fall outside the typical knowledge of this repo/maintainers.

Our mistake may have been a silly one (as they usually are)

We never put

Settings.initializeSDK();

And we were also missing:

const requestResult = await request(PERMISSIONS.IOS.APP_TRACKING_TRANSPARENCY); Settings.setAdvertiserTrackingEnabled(requestResult === RESULTS.GRANTED);

(for iOS)

We'll deploy soon and see if our changes resolve the issue.

One small recommendation if I may add would be to put this part of the README under the 'Installation/Setup' section or right after it and before the 'Troubleshooting' section.

For it to work you need to:
Run the app on a real device
Have the facebook app running in the background and logged in to an account
Have that account you used on Facebook added as an "Advertising Account" for your app on Facebook's dashboard
MOST IMPORTANT: Have ATT enabled both on the FACEBOOK APP and YOUR APP.
This will make it so events you log on your app by YOU—which I guess they determine by seeing who is logged in on the Facebook App— are the ones to show up on the Event manager.

And then the same goes for the 'Usage' section (e.g. putting it directly after Installation)

It could totally just be so if so, feel free to ignore the recommendation 😄 But I know in other repos/npm package docs. troubleshooting typically is the last section and instalation/setup + usage are at the top. I think my brain went too fast and just ignored anything after Troubleshooting. But that may be something I need to work!

Anyway, I will update this open issue with our resolution, in the case it may help anyone else in the future.

@mikehardy
Copy link
Collaborator

Hopefully your changes get things working for you! If they do, and the README could use improvement feel free to post a PR changing things up for the better, happy to merge anything reasonable and the github web UI for markdown editing is pretty easy to use when posting up docs PRs

@squirrelhomie
Copy link
Author

Well, we made some progress but still not able to link our app to optimize for app installs.

With our changes I put above we were able to verify our apps deep link and successfully test our app events via the App Ads Helper tool from Facebook.

We've continued our conversation with Facebook support and hoping we find a resolution soon.

If anyone in the community has successfully add react-native-fbsdk-next to their project and created a campaign in facebook optimized for app installs, please reach out 😊

@mikehardy I'd like to keep this issue open, if that's alright with you, until we figure it out because once we do, I think it would be helpful to help out next dev if they run into this issue.

@squirrelhomie
Copy link
Author

@mikehardy One more question - What impact, if any, are you aware of, does react-native-fbsdk-next lacking the Facebook SDK v14 have?

I believe I saw another issue related to this topic. Our app dashboard in facebook is saying that our iOS version is out of date (currently 13.2.0)

@mikehardy
Copy link
Collaborator

V14 just came out a few days ago. If you think that's the issue it would be great to post a PR doing the forward port to it. Unlikely that's the problem though

@squirrelhomie
Copy link
Author

Ok, great to know! Facebook support had recommended upgrading, but that didn't seem to be a necessary change.

@mikehardy
Copy link
Collaborator

Understandable on their part they want the upgrade, it's not possible to rule out their newest code has fixed some related thing, and as someone frequently pulled in to troubleshooting (like here) the rule of "update to current version and try to reproduce again" is reflexive, for good reason. I checked to see how difficult the forward-port to v14 was, it appeared nearly trivial. It's posted here #278

@mikehardy
Copy link
Collaborator

mikehardy commented Jun 22, 2022

Update, it seemed to work in testing of my work app so I just kicked it out via CI here. v9 is live (with fully up to date underlying SDKs) https://github.com/thebergamo/react-native-fbsdk-next/releases/tag/v9.0.0

@JonathanZWhite
Copy link

@mikehardy Thanks for upgrading to v14. I upgraded to 9.0.0 but it looks like events on iOS are not being registered. In Facebook event manager's test events tab, Android events are appearing in the dashboard.

Also, similar to OP, on our Facebook adsets we are seeing an error our ad account not being associated with our app's events. Below you can see that the test events are firing on Android but the issue persists.

Screen Shot 2022-06-23 at 2 21 15 AM

Screen Shot 2022-06-23 at 2 22 32 AM

@mikehardy
Copy link
Collaborator

mikehardy commented Jun 23, 2022

There may be something new with the new SDK or not, I'm not sure, unfortunately these things aren't use cases of mine. I use this SDK for login (and maintain it for that main purpose under auspices of my work on react-native-firebase for Invertase) and that works. So I'm not really a help here. My role will be limited really to merging PRs in this area, but the source is all available

@JonathanZWhite
Copy link

@mikehardy Appreciate you chiming in. I'll dig into the issue! @squirrelhomie could you post how you are initializing the SDK + where you are setting setAdvertiserTrackingEnabled?

Below are mine:

     [
        "react-native-fbsdk-next",
        {
          "appID": "[APP_ID]",
          "clientToken": "[CLIENT_TOKEN]",
          "displayName": "My App",
          "advertiserIDCollectionEnabled": false,
          "iosUserTrackingPermission": "This information is used to personalize your experience",
          "autoLogAppEventsEnabled": true
        }
      ]
// imported from expo-tracking-transparency
const { status } = await requestTrackingPermissionsAsync(); 

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

AppEventsLogger.logEvent('test_event');

@frankfuu
Copy link

frankfuu commented Jun 27, 2022

If anyone in the community has successfully add react-native-fbsdk-next to their project and created a campaign in facebook optimized for app installs, please reach out 😊

I'm facing the exact issue now. I'm able to get app events flowing through to my Facebook app as a source (checked via FB Events Manager) using react-native-fbsdk-next but Facebook Ads is still not allowing me to create an ad that optimizes for App Installs.

From research, it seems like it is because my iOS/Android apps have not yet been verified by Facebook via their app-ads.txt verification mechanism. I've followed their instructions but Facebook just won't confirm my ownership. It seems like i'm not alone. I'm not sure if this is a bug on Facebook's end or mine but according to facebook "After your ownership is confirmed, you’ll be able to optimize your ads for app installs."

At the end of the day, all we want is to see how many downloads and not who we got from the Fb Ad. This supposed simple task has been proven to be incredibly challenging. Does anyone have any pointers?

EDIT - It seems there is a bug on Facebook (potentially Playstore/App store too) and their mobile app ownership verification system. I'll leave the link here for others to follow (requires u to have a facebook developer account) - https://developers.facebook.com/support/bugs/1192900408124136/?join_id=f25832a0b30574c

EDIT 2- The solution that worked for me to overcome the mobile app ownership verification issue was to convert my app-ads.txt to UTF-8 and reupload. Hope this helps someone.

@sadez
Copy link

sadez commented Jul 4, 2022

The app install event is no longer sent when upgrading to the API version 14, I have remarked that by not receiving an App Install event (the others events works fine) on my new app with same configuration and code source of an old working app (with API 13)

And by switching the version in the settings of my old app it confirm my thought that it's related to the API version

image

The problem is that in the new app it's impossible to downgrade the API since Facebook not allowing to use old Version in newly created applications.

@alexanderblackh
Copy link

I'm seeing android and custom events on iOS submit fine, but automatic events such as install aren't appearing in the dashboard at all. I've also filed a ticket #288

@aaggarwa88
Copy link

Hi all if you haven't looked at the documentation for v14.0 upgrade, please check it out. It clearly states:

"Delay Automatic Event Logging for [Android] or [iOS]- Pause logging of app events, such as app installs and app launches, until User consent has been obtained."

https://developers.facebook.com/docs/app-events/upgrade-guide/

I am assuming this is what is causing issue for many of you.

@mikehardy
Copy link
Collaborator

Thanks for pointing that out, if it seems worthwhile and you wanted to PR the changelog with a note about this, it might help future folks

@alexanderblackh
Copy link

Unfortunately I have done that in our app @aaggarwa88, that didn't change anything for us sadly.

@spiritinlife
Copy link

Be aware of this facebook/facebook-android-sdk#1094

@ekegus
Copy link

ekegus commented Jul 25, 2022

We have recently set up the FB SDK for tracking events in our app. It also been quite a headache for us, and we are still seeing issues with the App Install event.

Surprisingly, we've had no real issues with our iOS integration, but are facing issues tracking app installs on Android.

Environment

  • react-native: 0.63.4
  • react-native-fbsdk-next: 8.0.4

Issues

  • The automated event App installs is not coming through on Android
  • We cannot optimise campaigns for App installs.

We do see other automated events such as 'App Launch'/'Activate app' on Android. We also see custom events.

We have no issues on iOS; it seems to be an Android-only issue.

@spiritinlife thank you for bringing the IP policy to my attention. Just for clarification: Are you saying that the app install event will work with Android SDK 13+ if the IP whitelist policy is blank?

So like this:

image

@spiritinlife
Copy link

spiritinlife commented Jul 25, 2022

@ekegus Yes you should have that blank, i have also opened the issue on facebook https://developers.facebook.com/support/bugs/716612102738375/.

This happens because the MOBILE_APP_INSTALL(App install) event is using the client_token as an access token and not an app or user access token as subsequents requests do. For some reason the client_token is subject to being blocked if you have defined ips in the Server IP allowlist. So only viable solution for me was to allow all ips.

After that change i see ios and android events coming in event manager ( including app install )

@ekegus
Copy link

ekegus commented Jul 25, 2022

Interesting. We have not set any IP policy so something else must be the reason for the MOBILE_APP_INSTALL(App install) not coming through on Android.

The only slightly suspect thing I see from our logs is this warning:

Background execution not allowed: receiving Intent { act=android.intent.action.PACKAGE_ADDED dat=package:com.google.android.googlequicksearchbox flg=0x4000010 (has extras) } to com.facebook.katana/com.facebook.feed.platformads.AppInstallReceiver

I see a similar warning for intent.action.PACKAGE_REMOVED. But I am not sure whether it is just a red herring.

@squirrelhomie have you been able to resolve the issues you've been having? Also, did you see any issues with the App install event on Android or were you only having issues on iOS?

@gokuls1999
Copy link

we have integrated react-native_fbsdk_next. All the automated events and manual events are working as expected. But I need some clarification on the "fb_codeless_debug" event. In our app this "fb_codeless_debug" event is triggering at some point and we don't know at which point this event is triggering. Is this one of the automated event? if yes please explain at which point this event will be triggered.

@mikehardy
Copy link
Collaborator

@gokuls1999 I think you might be better served examining / asking in the upstream facebook-ios-sdk / facebook-android-sdk repositories, we do not generate any events here, we just wrap the underlying SDKs

@nembence
Copy link
Contributor

nembence commented Sep 2, 2022

For my team the solution was enabling autoLogAppEventsEnabled and advertiserIDCollectionEnabled flags in the Expo app config which seems quite obvious right now. I know that maybe this is not ideal solution for everyone in this thread but if you're using Expo I'm quite sure this will be the solution. @mikehardy I will create a PR to update the Expo documentation to avoid the future misunderstandings about this flags.

@nembence
Copy link
Contributor

nembence commented Sep 2, 2022

Here you find the documentation about my solution: Enabling Auto App Installs in Expo

@stale
Copy link

stale bot commented Oct 2, 2022

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.

@stale stale bot added the wontfix This will not be worked on label Oct 2, 2022
@stale stale bot closed this as completed Oct 10, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
wontfix This will not be worked on
Projects
None yet
Development

No branches or pull requests