Skip to content

Commit 8ae55fb

Browse files
committed
Use event_category/event_label properties
1 parent c936053 commit 8ae55fb

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

functions/index.js

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -80,14 +80,18 @@ exports.sync_diagram = functions.https.onRequest(async (req, res) => {
8080
});
8181

8282
exports.track = functions.https.onRequest(async (req, res) => {
83-
console.log('request:', req.body)
83+
if(!req.body.event) {
84+
console.log('missing req.body.event');
85+
res.status(400).send('invalid request');
86+
return;
87+
}
88+
8489
mixpanel.track(req.body.event, {
8590
distinct_id: req.body.userId,
86-
category: req.body.category,
87-
label: req.body.label,
91+
event_category: req.body.category,
92+
event_label: req.body.label,
8893
displayProductName: 'FireWeb'
8994
});
90-
res.send('ok');
9195
});
9296

9397
exports.webhook = functions.https.onRequest(async (req, res) => {

0 commit comments

Comments
 (0)