facebook / facebook/facebook-ios-sdk
App Events not reaching Facebook / SKAdNetwork attribution problems
- Dominant language
- Swift
- Stars
- 8.1k
- Forks
- 3.7k
- PR merge metrics
- No merged PRs in 30d
Description
(this is a follow-up to consolidate the main questions from #1632 and #1639)
To summarize, despite trying very hard to follow all the best practices around iOS 14 App Events and install attribution, we are still failing to get events to appear in Facebook's App Events Insights panel, and failing to attribute installs to iOS 14 campaigns in Ads Manager. We are not sure if this is a code bug, or incorrect interpretation of the documentation, or maybe an issue with Facebook's internal data systems rather than the iOS SDK.
## Checklist
- [x] I've updated to the latest released version of the SDK (Yes, SDK `9.0.1`)
- [x] I've searched for existing [GitHub issues](https://github.com/facebook/facebook-ios-sdk/issues) (this continues discussion after #1632 was closed, since the issue is not fixed)
- [x] I've looked for existing answers on [Stack Overflow](https://facebook.stackoverflow.com), the [Facebook Developer Community Forum](https://developers.facebook.com/community/) and the [Facebook Developers Group](https://www.facebook.com/groups/fbdevelopers)
- [x] I've read the [Code of Conduct](https://github.com/facebook/facebook-ios-sdk/blob/master/CODE_OF_CONDUCT.md)
- [x] This issue is not security related and can safely be disclosed publicly on GitHub
## Environment
Describe your dev environment here, giving as many details as possible. If you have them, make sure to include:
- Xcode Version: `12.4`
- Swift Version: N/A
- Installation Platform & Verison: `Cocoapods` version `1.10.0`
## Goals/Expected Results
1. The Facebook SDK remains dormant until we receive user consent to send data, after which:
2. App Events appear in our Facebook App's Events insights panel, including both automatically-logged events like App Install plus manually-logged events from `[FBSDKAppEvents logEvent]`.
3. iOS 14 ad campaigns in Ads Manager show plausible App Install numbers, after waiting the proper 3 days for SKAdNetwork attribution to occur.
Note: at no point is the user signing in with a Facebook account, nor do we want to touch the IDFA at all. We only want to send what is possible without an active login session and without asking for IDFA.
(Actually, I'm afraid the docs are not very clear about whether this is even possible: can we send log events to Facebook without first asking the user to sign in, or querying the IDFA? It would be nice to clarify what data can be logged, if any, without these steps.)
## Actual Results
All App Events do appear in the iOS device log, when enabled via `[FBSDKSettings enableLoggingBehavior:FBSDKLoggingBehaviorAppEvents];`. This includes both automatically-logged and manually-logged events.
However, we do NOT see any events in the Events Manager Test Events panel (https://business.facebook.com/events_manager2/list/app/APPID/test_events), nor the Facebook App Insights panel (https://www.facebook.com/analytics/APPID/AppEvents/), even after 1+ days of waiting.
We can get events to appear in the Test Events panel and App Insights, but only if we do two weird things that seem to contradict the documentation:
1. We set the `_implicitlyLogged` flag to `1` on all events. This is an internal flag that the SDK normally adds only to automatically-logged events. Since automatically-logged events were occasionally appearing on the Test Events panel, we tried adding this flag ourselves, and suddenly all the events started appearing reliably (except App Install - see 2.).
2. We send an App Install event manually by logging a custom event named `fb_mobile_first_app_launch`. Even though we do set `[FBSDKSettings setAutoLogAppEventsEnabled:YES]`, the SDK doesn't seem to be sending its own App Install event.
With the above hacks, I think we are logging app events successfully.
However, we are doubtful that iOS 14 SKAdNetwork attribution is fully working yet, since we see far fewer App Install events in the Ads Manager interface than we would expect, relative to the number of link clicks and typical conversion rates of our campaigns. (based on historical trends, we are pretty confident that our click-to-install conversion rate should be at least 30%, but in Ads Manger we only see about 10% click-to-install on iOS 14 campaigns, which seems abnormally low).
## Steps to Reproduce
Here is how we are interacting with the SDK:
Info.plist, AppDelegate.m:
- all settings made as described in https://developers.facebook.com/docs/ios/getting-started/, plus:
```
FacebookAdvertiserIDCollectionEnabled
FacebookAutoInitEnabled
FacebookAutoLogAppEventsEnabled
```
After receiving user consent to share data (with explicit UI in GDPR countries, otherwise implicitly):
```objc
[FBSDKApplicationDelegate initializeSDK:nil];
[FBSDKSettings setAdvertiserTrackingEnabled:YES];
[FBSDKSettings setAutoLogAppEventsEnabled:YES];
```
i.e., we want to initialize the SDK and then send as much data as we possibly can, except without touching the IDFA.
After making the above 3 calls, I would expect to see events like App Install, App Launch, and our manually-logged events to start appearing in the Events Insights panel. (on Android, using the equivalent SDK calls, they indeed do appear). Also, I would expect that we should start seeing reasonable App Install counts on iOS 14 ad campaigns via SKAdNetwork, after waiting the proper 3-day period for delayed attribution.
Contributor guide
Assessment
This issue has not been assessed yet.