Skip to content

Commit cf14695

Browse files
fix: stitched events through redis in pixel
1 parent 306821e commit cf14695

File tree

2 files changed

+4
-5
lines changed

2 files changed

+4
-5
lines changed

src/v1/sources/shopify/webhookTransformations/serverSideTransform.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ const processEvent = async (inputEvent, metricMetadata) => {
129129
message.setProperty('anonymousId', anonymousId);
130130
} else {
131131
// if anonymousId is not present in note_attributes or note_attributes is not present, query redis for anonymousId
132-
const cartToken = getCartToken(message);
132+
const cartToken = getCartToken(event, message);
133133
const redisData = await RedisDB.getVal(cartToken);
134134
if (redisData?.anonymousId) {
135135
message.setProperty('anonymousId', redisData.anonymousId);

src/v1/sources/shopify/webhookTransformations/serverSideUtlis.js

+3-4
Original file line numberDiff line numberDiff line change
@@ -63,10 +63,9 @@ const getAnonymousIdFromAttributes = (event) => {
6363
* @param {Object} message
6464
* @returns {String} cart_token
6565
*/
66-
const getCartToken = (message) => {
67-
const { event, properties, context } = message;
68-
if (SERVERSIDE_STITCHED_EVENTS.includes(event)) {
69-
return context?.cart_token || properties?.cart_token || null;
66+
const getCartToken = (event, message) => {
67+
if (SERVERSIDE_STITCHED_EVENTS.includes(message?.event) || (message?.event) === 'Cart Update') {
68+
return event.cart_token || null;
7069
}
7170
return null;
7271
};

0 commit comments

Comments
 (0)