Skip to content

Commit f133ade

Browse files
committed
debug: Add logging to track function for Mixpanel debugging
1 parent 74a8550 commit f133ade

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

functions/index.js

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -260,11 +260,21 @@ exports.track = functions.https.onRequest(async (req, res) => {
260260
// Extract event name and userId, pass through all other properties
261261
const { event, userId, ...eventProperties } = req.body;
262262

263-
mixpanel.track(event, {
263+
console.log('Track request received:', {
264+
event,
265+
userId,
266+
eventProperties
267+
});
268+
269+
const mixpanelData = {
264270
distinct_id: userId,
265271
displayProductName: 'FireWeb',
266272
...eventProperties, // Pass through all additional properties from frontend
267-
});
273+
};
274+
275+
console.log('Sending to Mixpanel:', { event, properties: mixpanelData });
276+
277+
mixpanel.track(event, mixpanelData);
268278

269279
// Send a success response to prevent 502 Bad Gateway error
270280
res.status(200).send('Event tracked successfully');

0 commit comments

Comments
 (0)