Skip to content

Commit 2ce5aae

Browse files
committed
Added UUID to payload
- closes snowplow#244
1 parent 5b6f0a9 commit 2ce5aae

4 files changed

Lines changed: 7 additions & 1 deletion

File tree

core/CHANGELOG

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
Version 0.2.0 (2014-08-xx)
22
--------------------------
3+
Added UUID to payload (#244)
34
Added automatic timestamp generation (#243)
45
Added setter methods (#242)
56
Added timestamp parameter to tracker methods (#240)

core/lib/core.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
*/
1515

1616
var payload = require('./payload.js');
17+
var uuid = require('uuid');
1718

1819
module.exports = function trackerCore(base64, callback) {
1920

@@ -77,6 +78,7 @@ module.exports = function trackerCore(base64, callback) {
7778
*/
7879
function track(sb, context, tstamp) {
7980
sb.addDict(payloadPairs);
81+
sb.add('eid', uuid.v4());
8082
sb.add('dtm', tstamp || new Date().getTime());
8183
if (context) {
8284
sb.addJson('cx', 'co', completeContexts(context));

core/package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
],
2525
"license": "Apache-2.0",
2626
"dependencies": {
27-
"JSON": "^1.0.0"
27+
"JSON": "^1.0.0",
28+
"uuid": "^1.4.1"
2829
}
2930
}

core/tests/core.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@ define([
2424
var tracker = core(false);
2525

2626
function compare(result, expected, message) {
27+
assert.ok(result['eid'], 'A UUID should be attached to all events');
28+
delete result['eid'];
2729
assert.ok(result['dtm'], 'A timestamp should be attached to all events');
2830
delete result['dtm'];
2931
assert.deepEqual(result, expected, message);

0 commit comments

Comments
 (0)