Skip to content

Commit fa03133

Browse files
committed
Added timing event (closes snowplow#320)
1 parent 30b38d2 commit fa03133

1 file changed

Lines changed: 21 additions & 0 deletions

File tree

src/js/tracker.js

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1484,6 +1484,27 @@
14841484
*/
14851485
trackSiteSearch: function(terms, filters, totalResults, pageResults, context) {
14861486
core.trackSiteSearch(terms, filters, totalResults, pageResults, addCommonContexts(context));
1487+
},
1488+
1489+
/**
1490+
* Track a timing event (such as the time taken for a resource to load)
1491+
*
1492+
* @param string category Required.
1493+
* @param string variable Required.
1494+
* @param number timing Required.
1495+
* @param string label Optional.
1496+
* @param array context Optional. Context relating to the event.
1497+
*/
1498+
trackTiming: function (category, variable, timing, label, context) {
1499+
core.trackUnstructEvent({
1500+
schema: 'iglu:com.snowplowanalytics.snowplow/timing/jsonschema/1-0-0',
1501+
data: {
1502+
category: category,
1503+
variable: variable,
1504+
timing: timing,
1505+
label: label
1506+
}
1507+
}, addCommonContexts(context))
14871508
}
14881509
};
14891510
};

0 commit comments

Comments
 (0)