facebook-login icon indicating copy to clipboard operation
facebook-login copied to clipboard

App Events Facebook

Open cprodhomme opened this issue 2 years ago • 18 comments

Is your feature request related to a problem? Please describe. I want to implement App Events Facebook on my Ionic Capacitor project and use Facebook Login.

Describe the solution you'd like I want to have a function like this library : https://ionicframework.com/docs/native/facebook

.logEvent(MY_EVENT);

Describe alternatives you've considered

  • I have check to use this plugin : https://github.com/SpellChucker/capacitor-plugin-facebook-analytics But it's not work on Capacitor 4

  • I use this plugin https://ionicframework.com/docs/native/facebook but i think it's very complicated to use cordova plugin on Capacitor projet :( For now, my build doesn't work

Thanks ! 🙏

cprodhomme avatar Oct 05 '22 09:10 cprodhomme

Seems pretty straightforward to implement. Just add a method .logEvent(MY_EVENT);

https://developers.facebook.com/docs/app-events/getting-started-app-events-ios#manually-log-events https://developers.facebook.com/docs/app-events/getting-started-app-events-android#log-manually

codeconsole avatar Nov 11 '22 16:11 codeconsole

I am not sure if my app is configured properly because the only Test Events that I receive are

fb_login_dialog_confirm_accept
fb_login_dialog_confirm_impression

and I only receive these on iOS. I don't receive any Test Events on android. (I can't log events using facebookConnectPlugin.logEvent(String name, Object params, Number valueToSum, Function success, Function failure) https://github.com/cordova-plugin-facebook-connect/cordova-plugin-facebook-connect#log-an-event either so I believe this is a problem with my app).

@cprodhomme perhaps you can give it a try and see if it works for you.

Here is how you can test

git clone https://github.com/codeconsole/facebook-login
cd facebook-login
git checkout app-events

then update your app/package.json to your app to point to the plugin directory:

    "@capacitor-community/facebook-login": "file:../facebook-login",

My directory structure is:

app
facebook-login

Syntax is:

Capacitor.Plugins.FacebookLogin.logEvent({eventName:'BattleTheMonster'})

https://github.com/capacitor-community/facebook-login/pull/112

codeconsole avatar Nov 11 '22 19:11 codeconsole

Seems related to my issue https://github.com/SpellChucker/capacitor-plugin-facebook-analytics/issues/4

codeconsole avatar Nov 11 '22 23:11 codeconsole

I have determined on iOS, it is version specific. v13.5 works but 15.2 does not work.

Not sure if the following are related: https://developers.facebook.com/docs/audience-network/setting-up/platform-setup/ios/add-sdk/ https://stackoverflow.com/questions/68599825/not-receiving-events-via-facebook-ios-sdk https://developers.facebook.com/docs/app-events/guides/advertising-tracking-enabled/ https://stackoverflow.com/questions/67832203/cannot-find-fbadsettings-isadvertisertrackingenabledtrue https://developers.facebook.com/docs/app-events/getting-started-app-events-ios#add-events

codeconsole avatar Nov 12 '22 00:11 codeconsole

I just confirmed Capacitor.Plugins.FacebookLogin.logEvent({eventName:'BattleTheMonster'}) also works with iOS 13.7 devices.

codeconsole avatar Nov 12 '22 02:11 codeconsole

https://github.com/facebook/facebook-ios-sdk/issues/1937

codeconsole avatar Nov 12 '22 04:11 codeconsole

https://github.com/xamarin/FacebookComponents/issues/228

codeconsole avatar Nov 12 '22 05:11 codeconsole

I confirm Android works. The only issue is iOS 14+

https://github.com/facebook/facebook-ios-sdk/issues/2145

codeconsole avatar Nov 12 '22 07:11 codeconsole

iOS 14+ works ask long as Allow Tracking is turned on inside the Facebook App of the user signing in regardless of whether or not the Facebook App is installed on the same device running the app.

codeconsole avatar Nov 13 '22 01:11 codeconsole

Would be amazing if u could add it to the package, I was trying to use https://github.com/cordova-plugin-facebook-connect/cordova-plugin-facebook-connect on my capacitor project without success, I'm unable to build the app

But It would be nice if you could add logEvent, setUserData and clearUserData

FernetB avatar Nov 15 '22 18:11 FernetB

@FernetB for logEvent, you can just use my repository for the time being until it is merged.

To use my version instead, just do:

nom install https://github.com/codeconsole/facebook-login#app-events

Looking at the FB developer documentation, I am not seeing anything on setUserData or clearUserData. Are those associated with analytics? That was shut off by FB.

https://www.facebook.com/business/help/966883707418907 https://developers.facebook.com/docs/reference/android/current/class/AppEventsLogger/

codeconsole avatar Nov 15 '22 23:11 codeconsole

Hey, thanks for the fast response!

I saw that from here https://github.com/cordova-plugin-facebook-connect/cordova-plugin-facebook-connect#advanced-matching and here https://developers.facebook.com/docs/app-events/advanced-matching/

FernetB avatar Nov 16 '22 00:11 FernetB

@FernetB

I think it was removed from the API because if you see here https://developers.facebook.com/docs/app-events/advanced-matching/ It shows setUserData is a method of AppEventsLogger, but the links to the documentation for AppEventsLogger are broken.

And of you view the latest documentation https://developers.facebook.com/docs/reference/android/current/class/AppEventsLogger/ there is no setUserData method

codeconsole avatar Nov 16 '22 06:11 codeconsole

@codeconsole do you have idea if automatic app install events will be tracked ? Just wonder if we can use this for it...

gelinger777 avatar Dec 07 '22 23:12 gelinger777

Is it possible to user the plugin to trace app installations and other events? are there any limitations on ios or android?

marshall86 avatar May 15 '23 09:05 marshall86

same question. can i use this plugin for tracking app installs ?

trinitiwowka avatar Sep 11 '23 21:09 trinitiwowka

Please add a second parameter in LogEvent function like this:

logEvent(options: { name: string, params: any })

so we can use it to log all events related to facebook ads

Linknpay avatar Dec 23 '23 23:12 Linknpay

@trinitiwowka @marshall86 You can use this freshly new plugin that is compatible with Capacitor 5 https://www.npmjs.com/package/capacitor-facebook-events

Linknpay avatar Dec 26 '23 17:12 Linknpay