Skip to content

Commit 74a8550

Browse files
MrCoderclaude
andcommitted
fix: Pass through all event properties in Mixpanel tracking
The Firebase /track function was only passing limited properties to Mixpanel (category, label), missing detailed survey data like mostImportant, leastImportant, feature names, etc. Updated to use object destructuring to pass through all frontend properties while maintaining backward compatibility with existing events. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <[email protected]>
1 parent 5e94284 commit 74a8550

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

functions/index.js

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -257,11 +257,13 @@ exports.track = functions.https.onRequest(async (req, res) => {
257257
return;
258258
}
259259

260-
mixpanel.track(req.body.event, {
261-
distinct_id: req.body.userId,
262-
event_category: req.body.category,
263-
event_label: req.body.label,
260+
// Extract event name and userId, pass through all other properties
261+
const { event, userId, ...eventProperties } = req.body;
262+
263+
mixpanel.track(event, {
264+
distinct_id: userId,
264265
displayProductName: 'FireWeb',
266+
...eventProperties, // Pass through all additional properties from frontend
265267
});
266268

267269
// Send a success response to prevent 502 Bad Gateway error

0 commit comments

Comments
 (0)