Skip to content

Commit b847a65

Browse files
author
Matt Carroll
committed
Easy Event Tracking
1 parent 7fe2e0e commit b847a65

File tree

8 files changed

+360
-561
lines changed

8 files changed

+360
-561
lines changed

packages/optimizely-sdk/lib/core/event_builder/index.js

Lines changed: 2 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@ function getCommonEventParams(options) {
5757
client_name: options.clientEngine,
5858
client_version: options.clientVersion,
5959
anonymize_ip: anonymize_ip,
60+
enrich_decisions: true,
6061
};
6162

6263
// Omit attribute values that are not supported by the log endpoint.
@@ -115,26 +116,14 @@ function getImpressionEventParams(configObj, experimentId, variationId) {
115116
* @param {Object} configObj Object representing project configuration
116117
* @param {string} eventKey Event key representing the event which needs to be recorded
117118
* @param {Object} eventTags Values associated with the event.
118-
* @param {Array} experimentsToVariationMap Map of experiment IDs to bucketed variation IDs
119119
* @param {Object} logger Logger object
120120
* @return {Object} Conversion event params
121121
*/
122-
function getVisitorSnapshot(configObj, eventKey, eventTags, experimentsToVariationMap, logger) {
122+
function getVisitorSnapshot(configObj, eventKey, eventTags, logger) {
123123
var snapshot = {
124-
decisions: [],
125124
events: []
126125
};
127126

128-
fns.forOwn(experimentsToVariationMap, function(variationId, experimentId) {
129-
var decision = {
130-
campaign_id: projectConfig.getLayerId(configObj, experimentId),
131-
experiment_id: experimentId,
132-
variation_id: variationId,
133-
};
134-
135-
snapshot.decisions.push(decision);
136-
});
137-
138127
var eventDict = {
139128
entity_id: projectConfig.getEventId(configObj, eventKey),
140129
timestamp: fns.currentTimestamp(),
@@ -199,7 +188,6 @@ module.exports = {
199188
* @param {Object} options.configObj Object representing project configuration, including datafile information and mappings for quick lookup
200189
* @param {string} options.eventKey Event key representing the event which needs to be recorded
201190
* @param {Object} options.eventTags Object with event-specific tags
202-
* @param {Object} options.experimentsToVariationMap Map of experiment IDs to bucketed variation IDs
203191
* @param {Object} options.logger Logger object
204192
* @param {string} options.userId ID for user
205193
* @return {Object} Params to be used in conversion event logging endpoint call
@@ -215,7 +203,6 @@ module.exports = {
215203
var snapshot = getVisitorSnapshot(options.configObj,
216204
options.eventKey,
217205
options.eventTags,
218-
options.experimentsToVariationMap,
219206
options.logger);
220207

221208
commonParams.visitors[0].snapshots = [snapshot];

0 commit comments

Comments
 (0)