Skip to content

Instantly share code, notes, and snippets.

@ronfe
Created April 16, 2016 08:38
Show Gist options
  • Save ronfe/b89db687aef9a036ce4119d6640bc219 to your computer and use it in GitHub Desktop.
Save ronfe/b89db687aef9a036ce4119d6640bc219 to your computer and use it in GitHub Desktop.
backSchema = new Schema({
"eventKey": {type: String, required: true},
"eventValue": {type: Mixed},
"ua": String,
"url": String, //only for pc, the full url
"category": "onionsBackend", // to string
"platform": "backend", //Required
"ip": String,
"location": {type: Mixed},
"user": ObjectId, //Required when user logged in, its user id
"role": {"type": String, "enum": ["teacher", "student", "editor", "visitor"]},
"eventTime": {type: Number, required: true}, //Required, timeStamp of points generated, unix epoch time (in ms)
"serverTime": {type: Date, default: Date.now} //Server required, Time recorded by server
});
[
{
"origin": {
"method": "POST",
"route": "/signup"
},
"track": {
"eventKey": "signupSuccess",
"eventValue": {"channel": "req.body.channel"},
}
},
{
"origin": {
"method": "PUT",
"route": "/me/progress/:subject/topics/:topicId/entered"
},
"track": {
"eventKey": "startTopic",
"eventValue": {"topicId": "req.params.topicId", "subject": "req.params.subject"}
}
}
]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment