Optional timestamp argument
Each track...()
method supports an optional timestamp property; this allows you to manually override the timestamp attached to this event. The timestamp should be in milliseconds since the Unix epoch.
If you do not pass this timestamp in as an argument, then the JavaScript Tracker will use the current time to be the timestamp for the event.
Here is an example tracking a self describing event and supplying the optional timestamp argument.
trackSelfDescribingEvent({
event: {
schema: 'iglu:com.acme/event/jsonschema/1-0-0',
data: { type: 'user_action' }
},
timestamp: 1368725287000
});
Timestamp is counted in milliseconds since the Unix epoch – the same format as generated by new Date().getTime()
.
Also you can attach a true timestamp to the event, replacing the device timestamp. For example:
trackSelfDescribingEvent({
event: {
schema: 'iglu:com.acme/event/jsonschema/1-0-0',
data: { type: 'user_action' }
},
timestamp: { type: 'ttm', value: 1368725287000 }
});
Above will attach ttm
(true_tstamp
) parameter instead of default dtm
. You can also use, plain number or { type: 'dtm', value: stamp }
to send `dvce_created_tstamp`
.