facebook-nodejs-business-sdk
facebook-nodejs-business-sdk copied to clipboard
How to pass eventId using this api?
I'm using this package to send server side events to facebook. On the client I can set an eventId to uniquely identify the event and pass that down to the server where I'd like to send it too. This is required for deduplication. How do I add an eventId to my server event?
There's an option using the server event to use "setEventId" (found it somewhere in the internet) But it doesn't seem to work. So I'm joining the question too. It seems when using EventRequest, the eventId of the server event is neglected and not being used. It's missing here. Though it looks like an event of multiple instances of server event, so not sure why it's not being used.
Although it wasn't in the docs, I was able to get it from the source code in Github. My serverEvent setup looks like the following and it's working for me. But I had to generate the unique eventId on the client-side, use it in the client FB tracking call and then pass that same clientId to the server. That clientId shows in the FB ad manager site as matching up now.
Client side: fbq("trackCustom", event, {}, {eventID: eventId});
Server side: const serverEvent = new ServerEvent() .setEventName(event) .setEventTime(current_timestamp) .setUserData(userData) .setEventSourceUrl(url) .setActionSource("website") .setEventId(eventId);
That's interesting, for some reason it doesn't work for me and the eventId is not recognised inside the Business Manager. I'll try perhaps some other configurations. Thanks for the confirmation it does work for you.
I assume https://github.com/facebook/facebook-nodejs-business-sdk/pull/216 would be related.