facebook / facebook-ios-sdk

Used to integrate the Facebook Platform with your iOS & tvOS apps.
https://developers.facebook.com/docs/ios
Other
7.78k stars 3.53k forks source link

Cannot see events on Events Manager dashboard #2068

Open CRoig opened 2 years ago

CRoig commented 2 years ago

Checklist before submitting a bug report

Xcode version

13.3.1

Facebook iOS SDK version

13.2.0

Dependency Manager

SPM

SDK Framework

Core

Goals

See my events displayed on Events Manager

Expected results

After opening the app, I want to see session started event on Event Manager

Actual results

Nothing appears

Steps to reproduce

Find in code samples, the content of my AppDelegate

Code samples & details

AppDelegate.swift 

func application(_ app: UIApplication, open url: URL, options: [UIApplication.OpenURLOptionsKey: Any] = [:]) -> Bool {
        return ApplicationDelegate.shared.application(app,
                                                   open: url,
                                                   sourceApplication: options[UIApplication.OpenURLOptionsKey.sourceApplication] as? String,
                                                   annotation: options[UIApplication.OpenURLOptionsKey.annotation])
}

SceneDelegate.swift

func scene(_ scene: UIScene, openURLContexts URLContexts: Set<UIOpenURLContext>) {
        guard let url = URLContexts.first?.url else { return }
        AEMReporter.configure(withNetworker: nil, appID: "XXXXXXXXX", reporter: nil)
        AEMReporter.enable()
        AEMReporter.handle(url)
        ApplicationDelegate.shared.application(
            UIApplication.shared,
            open: url,
            sourceApplication: nil,
            annotation: [UIApplication.OpenURLOptionsKey.annotation]
        )
    }

Setup Settings

Settings.shared.enableLoggingBehavior(.appEvents)
Settings.shared.enableLoggingBehavior(.networkRequests)
Settings.shared.enableLoggingBehavior(.developerErrors)
Settings.shared.enableLoggingBehavior(.graphAPIDebugInfo)
Settings.shared.enableLoggingBehavior(.accessTokens)
Settings.shared.isAutoLogAppEventsEnabled = true
Settings.shared.isAdvertiserIDCollectionEnabled = true
CRoig commented 2 years ago

Also, I found out that a request is made on every event to

https://graph.facebook.com/v13.0/XXXXXXXX/aem_conversion_configs?advertiser_ids=%5B%5D&debug=info&fields=&format=json&include_headers=false&sdk=ios

and the response is always

{ "data": [

] }

CRoig commented 2 years ago

After firing the Settings configs on didBecomeActive, I manage to see events being flushed. Nevertheless, I still can not see them on Event Manager

FBSDKLog: FBSDKAppEvents: Flushed @ 1653398625.000000, 3 events due to 'EagerlyFlushingEvent' - {
.....
Flush Result: Success
DmitryGolovin-azur commented 2 years ago

same

remychantenay commented 2 years ago

Exact same issue here, despite following the documentation to the tee.

Xcode version: 13.4 Facebook iOS SDK version: 13.2.0 (also tried 13.0.0 and 12.3.2)

Requests against graph.facebook.com are successful (200, empty data), but nothing shows in Events Manager.

We also tried – in vain – while having the Facebook app installed (logged in) in the background with ATT enabled on both apps after spotting this comment.

We are running out of ideas.

ahtokca commented 2 years ago

Same here, I do see events flushed both android/ios and Deep Link verification passed, however no events recorded

I've contacted FB support and got "App has not configured properly with FB SDK." with an advice to read https://developers.facebook.com/docs/app-ads/overview

matthewfx commented 2 years ago

In my case, in addition to the above, the Event manager displays the warning "Update your apps to the latest Facebook SDK"... I can see in logs that SDK makes calls etc but apparently I don't have the SDK...

hateart commented 2 years ago

I struggled with the same issue until went through this checklist https://github.com/thebergamo/react-native-fbsdk-next/issues/66#issuecomment-888708757 Finally, events start work.

spiritinlife commented 2 years ago

Check if you have defined ips in Server ip Whitelist in Settings > Advanced > Security. If that is the case u are subject to this issue that i opened in facebook android sdk ( https://github.com/facebook/facebook-android-sdk/issues/1094 ) but is the same of ios. It seems requests like App install to the graph api use the client token when in the previous sdks they didn't. For some reason such requests are subject to be blocked if the client ip is not in the Server ip Whitelist. For mobile clients this is ridiculous so the only viable solution for now is to not have any ips defined in the Server ip whitelist so that u can whitelist all.

matthewfx commented 2 years ago

Thanks for your advice but I've given up on integrating with Facebook SKD. It should be straightforward and easy but it seems like they don't care and configuring it properly is more like walking through a minefield.

AlexSheiko commented 2 years ago

Adding ApplicationDelegate.initialize() to AppDelegate.swift helped me finally see the events

Screenshot 2022-07-29 at 15 42 20

Full code:

  1. AppDelegate.swift
    
    import UIKit
    import Foundation
    import FBSDKCoreKit

@UIApplicationMain @objc class AppDelegate: FlutterAppDelegate { override func application( _ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]? ) -> Bool {

    ApplicationDelegate.shared.application(application, didFinishLaunchingWithOptions: launchOptions)
    ApplicationDelegate.initialize()
    Settings.shared.isAutoLogAppEventsEnabled = true
    Settings.shared.isAdvertiserIDCollectionEnabled = true
    Settings.shared.isAdvertiserTrackingEnabled = true

    return super.application(application, didFinishLaunchingWithOptions: launchOptions)
}

override func applicationDidBecomeActive(_ application: UIApplication) {
    AppEvents.shared.activateApp()
    Settings.shared.enableLoggingBehavior(.appEvents)
    Settings.shared.enableLoggingBehavior(.developerErrors)
    Settings.shared.enableLoggingBehavior(.cacheErrors)
    Settings.shared.enableLoggingBehavior(.uiControlErrors)
}

}


 2. Info.plist
CFBundleURLTypes CFBundleURLSchemes fb... FacebookAppID ... FacebookDisplayName ... FacebookClientToken ... FacebookAutoLogAppEventsEnabled true FacebookAdvertiserIDCollectionEnabled true
DonTharaka commented 2 years ago

Facebook documentation on app events is very vague. It does not contain any information about ATTrackingManager which is necessary to track events. First follow all steps in the documentation. Below are the steps I have taken to successfully connect app events (iOS 15):

  1. Info.Plist Screen Shot 2022-08-11 at 10 44 47 am

  2. SceneDelegate

Screen Shot 2022-08-11 at 10 50 43 am

Screen Shot 2022-08-11 at 11 05 33 am

Screen Shot 2022-08-11 at 10 48 40 am

This will bring up the following pop up:

Screen Shot 2022-08-11 at 10 58 05 am

  1. In your viewcontroller:

Screen Shot 2022-08-11 at 10 52 39 am

ghost commented 1 year ago

i am working for last 3 days

Device : iPhone 13 version: iOS 16.5

Screenshot 2023-06-12 at 12 14 05 PM

After implementing i see my device version in the list with event

Screenshot 2023-06-12 at 12 12 38 PM

Also check my log

2023-06-10 15:57:12.456735+0530 OJOLife[29995:7162246] FBSDKLog: FBSDKAppEvents: Flushed @ 1686392832.000000, 1 events due to 'Timer' - {
    "advertiser_id" = "4B95C0EB-73AB-43A2-9E6C-XXXXXXXXXX";
    "advertiser_id_collection_enabled" = 1;
    "advertiser_tracking_enabled" = 1;
    "anon_id" = "XZ3AE32712-B137-47E2-8071-XXXXXXXXX";
    "application_tracking_enabled" = 1;
    "custom_events" = "[{\"_eventName\":\"fb_mobile_content_view\",\"_logTime\":1686392821,\"fb_content\":\"{\\\"screen\\\":\\\"Home\\\"}\",\"_ui\":\"OJOLife.NavVC\"}]";
    event = "CUSTOM_APP_EVENTS";
    extinfo = "[\"i2\",\"com.ojolife.dietitioclinic\",\"5\",\"1.2.0\",\"16.5\",\"iPhone14,5\",\"en_IN\",\"IST\",\"--\",390,844,\"3.00\",6,119,5,\"Asia\\/Kolkata\"]";
    ud = "{}";
    "url_schemes" = "[\"com.googleusercontent.apps.XXXXXX-962s8s2nhitmvivqie5h9ls3t8m6rf1g\",\"https\",\"com.ojolife.dietitioclinic\",\"App-prefs\"]";
}
Events: [
  {
    "event" : {
      "_eventName" : "fb_mobile_content_view",
      "_logTime" : 1686392821,
      "fb_content" : "{\"screen\":\"Home\"}",
      "_ui" : "OJOLife.NavVC"
    },
    "isImplicit" : false
  }
]

but when i see the custom log events for iphone where as i cant find any one where for android working fine

Screenshot 2023-06-12 at 12 18 58 PM