Skip to content
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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

App Events with null-value params silently do not get sent to Facebook #36

Closed
taylorkline opened this issue May 19, 2021 · 5 comments
Closed
Labels
enhancement New feature or request question Further information is requested

Comments

@taylorkline
Copy link

taylorkline commented May 19, 2021

馃悰 Bug Report

In idiomatic JavaScript, it is common to generate objects like:

{
  exampleParam: x ? x.value : null,
}

However, passing this object to logPurchase as the third parameter, params when exampleParam is null results in the event silently not propagating to Facebook Events.

To Reproduce

Issue the following event:

AppEventsLogger.logPurchase(15, "USD", { exampleParam: "hello", exampleParam2: null });

This event will never show up under the "Test Your Events in Real Time" pane at https://www.facebook.com/events_manager2/

Expected Behavior

One of the following, in order of ideal behavior:

  1. react-native-fbsdk-next cleans out null object properties and sends the event to Facebook
  2. An error is logged to be easily caught in logcat
  3. An exception is thrown and the error is not sent to Facebook

Code Example

Issue the event under "To Reproduce" while looking at the "Test Your Events in Real Time" pane at https://www.facebook.com/events_manager2/

Environment

The specific react native environment should not affect this issue.

@mikehardy
Copy link
Collaborator

Is there any Javascript API to reference off of for apis and type references ? Just curious

@taylorkline
Copy link
Author

taylorkline commented May 20, 2021

@mikehardy I'm sorry, I'm afraid I don't understand your question. Can you elaborate on your question?

@mikehardy
Copy link
Collaborator

Sorry I wasn't clear - we are a "downstream" sdk wrapping native libraries with a javascript interface. But there may be an "upstream" (official, direct from Facebook) JS SDK. I don't know if there is or not, but you might or could check. Assuming there is one, it probably has a similar API, and if it does - for general portability of code between native SDK wrappers (us) and pure-JS code (always an option, maybe needed for react-native-web) if there is an upstream API or way they handle this, we should try to harmonize?

So stated more clearly:

  • is there an official Facebook JS sdk that has anything like appevents? Looks like there is:

https://developers.facebook.com/docs/reference/javascript/FB.AppEvents.LogEvent - it is deprecated unfortunately but there is also https://developers.facebook.com/docs/facebook-pixel/reference

  • if so is there a link to any similar API ?

The deprecated version has the same API, and it enforces this, not sure how it enforces it though? Does it throw?

More concretely for the Java SDK: https://developers.facebook.com/docs/unity/reference/current/FB.LogAppEvent#logpurchase

Any parameters needed to describe the event. Elements included in this dictionary can't be null

So we should definitely check input params and reject (or if we are swallowing error we should instead propagate them, are we? Can verify maybe via adb logcat or code inspection)

For future thinking: how does the new "Pixel" SDK behave when you feed it's methods bad data? quietly log? cleaning? a throw?

So a few questions just to help this library stay in harmony with the way the rest of the FB SDK ecosystem works with regard to invalid input

In the end it will probably boil down to code inspection here to make sure we are not swallowing native exceptions but are bubbling them up when/if they happen, and maybe JS code that validates input

@thebergamo thebergamo added bug Something isn't working enhancement New feature or request question Further information is requested and removed bug Something isn't working labels May 27, 2021
@mikehardy
Copy link
Collaborator

Everyone should re-try with v6 of this library to see if it affects things, it has the up to date native libraries.
I'm going to close this as I'm not sure there is anything this module specifically can do other than stay up to date with native lib versions, but please feel free to continue sharing information on how best to use the available APIs / configurations

@taylorkline
Copy link
Author

Sure, that makes sense. Thanks @mikehardy

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request question Further information is requested
Projects
None yet
Development

No branches or pull requests

3 participants