facebook-ios-sdk icon indicating copy to clipboard operation
facebook-ios-sdk copied to clipboard

Cannot see events on Events Manager dashboard

Open CRoig opened this issue 2 years ago • 12 comments

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 avatar May 19 '22 11:05 CRoig

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 avatar May 19 '22 12:05 CRoig

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

CRoig avatar May 24 '22 13:05 CRoig

same

DmitryGolovin-azur avatar Jun 08 '22 21:06 DmitryGolovin-azur

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.

remychantenay avatar Jun 09 '22 08:06 remychantenay

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

ahtokca avatar Jun 12 '22 14:06 ahtokca

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...

matthewfx avatar Jun 21 '22 04:06 matthewfx

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.

hateart avatar Jun 23 '22 11:06 hateart

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.

spiritinlife avatar Jul 22 '22 18:07 spiritinlife

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.

matthewfx avatar Jul 26 '22 01:07 matthewfx

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)
   }
}
  1. Info.plist
<key>CFBundleURLTypes</key>
<array>
	<dict>
		<key>CFBundleURLSchemes</key>
		<array>
			<string>fb...</string>
		</array>
	</dict>
</array>
<key>FacebookAppID</key>
<string>...</string>
<key>FacebookDisplayName</key>
<string>...</string>
<key>FacebookClientToken</key>
<string>...</string>
<key>FacebookAutoLogAppEventsEnabled</key>
<string>true</string>
<key>FacebookAdvertiserIDCollectionEnabled</key>
<string>true</string>

AlexSheiko avatar Jul 29 '22 12:07 AlexSheiko

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

DonTharaka avatar Aug 11 '22 01:08 DonTharaka

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

ghost avatar Jun 12 '23 06:06 ghost