-
Notifications
You must be signed in to change notification settings - Fork 85
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
Facebook Pixel event_id discrepancy #486
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
size-limit report
Path | Size | Loading time (3g) | Running time (snapdragon) | Total time |
---|---|---|---|---|
dist/rudder-analytics.min.js | 35.65 KB (0%) | 714 ms (0%) | 329 ms (+6.23% 🔺) | 1.1 s |
The branch should be created off of the production-staging branch and PR also needs to be raised against the same. |
@@ -310,7 +310,7 @@ class FacebookPixel { | |||
: this.formatRevenue(price), | |||
}, | |||
{ | |||
eventID: messageId, | |||
event_id: traits.event_id || context.traits.event_id || properties.event_id || messageId, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Rather than doing this multiple time can we use an util function to achieve this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
utils/getEventId.js
Outdated
@@ -0,0 +1,4 @@ | |||
function getEventId(message){ | |||
return traits.event_id || context.traits.event_id || properties.event_id || messageId; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
message is passed but traits.event_id
is referenced, but we are not extracting traits hence traits, context, properties and messageId will always be undefined
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Committed new changes, please check once
@@ -73,7 +74,7 @@ class FacebookPixel { | |||
|
|||
page(rudderElement) { | |||
const { properties, messageId } = rudderElement.message; | |||
window.fbq("track", "PageView", properties, { eventID: messageId }); | |||
window.fbq("track", "PageView", properties, { getEventId(message) }); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
shouldn't this be { event_id: getEventId(message) }
?
window.fbq("track", "PageView", properties, { getEventId(message) }); | |
window.fbq("track", "PageView", properties, { event_id: getEventId(message) }); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
@@ -73,7 +74,7 @@ class FacebookPixel { | |||
|
|||
page(rudderElement) { | |||
const { properties, messageId } = rudderElement.message; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
const { properties, messageId } = rudderElement.message; | |
const { properties } = rudderElement.message; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
utils/getEventId.js
Outdated
@@ -0,0 +1,4 @@ | |||
function getEventId(message){ | |||
return message.traits.event_id || message.context.traits.event_id || message.properties.event_id || message.messageId; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you move this file to FacebookPixel folder as its specif to its use case. And rename this file as util.js
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
Co-authored-by: Utsab Chowdhury <utsab.c97@gmail.com>
Description of the change
Type of change
Related issues
Checklists
Development
Code review
This change is