Skip to content

Events not logging #4

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

Open
hisamsabounitadg opened this issue Feb 19, 2021 · 3 comments
Open

Events not logging #4

hisamsabounitadg opened this issue Feb 19, 2021 · 3 comments

Comments

@hisamsabounitadg
Copy link

hisamsabounitadg commented Feb 19, 2021

First off, thanks for working on this plugin. I've looked everywhere and cannot find one solution for using facebook analytics and capacitor/ionic react based applications.

I've implemented everything as you've described. Yet, I see no events flowing through to facebook when I check the events stream.

I am testing on a device and simulator both running iOS 14. I have entered the FacebookAppID and FacebookDisplayName in the info.plist file.

I am running on:

@capacitor/core 2.4.2
@capacitor/ios 2.4.2

The app is based on @types/react 16.9.17 and @ionic/react 5.0.7

When I try to log an event in XCode I receive the message: "To Native -> FacebookAnalytics logEvent " followed by an event number.

Using the facebook datasources view, I do not see any events appearing in the test view where I would typically get a live stream of all incoming events.

Any idea whats going on? Thanks for you help and effort on this!

Example Usage:

const { FacebookAnalytics } = Plugins;
FacebookAnalytics.logEvent({ event:'test_event', params:{platform:'ios'}})

Edit: I think I might have found the issue. Additional code needs to be added to AppDelegate.swift to activate the FBSDK.

As marked here in the facebook docs: https://developers.facebook.com/docs/ios/getting-started/

Now I am seeing the same message as marked in Issue #3 for support on iOS 14. Now in Facebook event manager the events still do not show up but I get the message:
" Improvements to the Facebook SDK for iOS

Open
We released a newer version of the Facebook SDK for iOS that supports the SKAdNetwork and iOS 14. Update to the latest version for all apps to help enable the delivery and performance of your iOS 14 ad campaigns."

@nourkrimesh
Copy link

I tried the latest version of this plugin that mentioned it supports iOS 14 but the events still not logging for iOS 14
Did you find a solution?!

@hisamsabounitadg
Copy link
Author

hisamsabounitadg commented Apr 19, 2021

I tried the latest version of this plugin that mentioned it supports iOS 14 but the events still not logging for iOS 14
Did you find a solution?!

I was able to get it working on iOS. First you have to correct the PodSpec File (Fixed in latest version 0.0.4). I had to go into the AppDelegate.Swift file and import FBSDKCoreKit then in applicationDidBecomeActive add activateApp:
`
func applicationDidBecomeActive(_ application: UIApplication) {
// Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface.
AppEvents.activateApp()
}

`

With that I was good to go with Facebook on iOS 14. Note that the facebook events manager is quite slow to show the events coming through (about a 20-30 minute delay). To be sure that your events are flowing through you can add to you AppDelegate.Swift file in application:

`
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
// Override point for customization after application launch.

ApplicationDelegate.shared.application(
    application,
    didFinishLaunchingWithOptions: launchOptions
)

print("check if autolog enabled: \(Settings.isAutoLogAppEventsEnabled)")
Settings.enableLoggingBehavior(.appEvents)

return true

}
`

I am unable to get this to work on Android as of now.

@ivansoldoid90t
Copy link

ivansoldoid90t commented Apr 29, 2021

Hi @hisamsabounitadg, First of all, thank you for getting work in iOS. Were you able to make it work on android?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants