-
Notifications
You must be signed in to change notification settings - Fork 42
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
There's one simple "start" event now that ships the main version. On every new event, we'll include the origin and session_id so we can track events. A lot of this is still new, so i'm not sure which events we'll want to gather and how we'll do analytics and what not.
- Loading branch information
1 parent
340c527
commit 8e19180
Showing
8 changed files
with
9,445 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
;(function(Agent) { | ||
|
||
var Parse = Agent.Parse; | ||
var session_id = Agent.randomString(10); | ||
|
||
|
||
var saveRecord = function(object, data) { | ||
object.save(data, { | ||
success: function(object) { | ||
}, | ||
error: function(model, error) { | ||
} | ||
}); | ||
} | ||
|
||
Agent.markEvent = function(eventName, data) { | ||
if (Agent.disableAnalytics) { | ||
return; | ||
} | ||
|
||
var Event = Parse.Object.extend("Event"); | ||
var event = new Event(); | ||
|
||
var eventData = _.extend({ | ||
event_name: eventName, | ||
session_id: session_id, | ||
url: window.location.origin | ||
}, data); | ||
|
||
saveRecord(event, eventData); | ||
} | ||
|
||
Agent.startAnalytics = function() { | ||
Parse.initialize("ZMtYo1w9R7U8FcTX4NPSlCCTTYl41PRhEz19yREC", "fjfnW6iqB9KwtRh6yBwuQrLlYPYgwR3reEC4KkNH"); | ||
} | ||
}(Agent)); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
;(function(Agent) { | ||
|
||
Agent.randomString = function(length) { | ||
var chars = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'; | ||
var result = ''; | ||
for (var i = length; i > 0; --i) result += chars[Math.round(Math.random() * (chars.length - 1))]; | ||
return result; | ||
} | ||
|
||
|
||
}(Agent)); |
Oops, something went wrong.