Skip to content

Instantly share code, notes, and snippets.

@Danny-Driscoll
Last active July 2, 2020 05:56
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save Danny-Driscoll/d3f5cbbfba3bb3206f19665ee64ef231 to your computer and use it in GitHub Desktop.
var heapDecision = function(decision) {
var type = decision.type
if (type == "feature") {
var info = decision.decisionInfo;
var featureKeyString = "[Optimizely Feature] " + info.featureKey;
var enabled = info.featureEnabled;
heap.addUserProperties(
{featureKeyString:enabled}
);
if (info.source == "feature-test") {
var experimentKeyString = "[Optimizely Experiment] " + info.sourceInfo.experimentKey;
var experimentVarString = "" + info.sourceInfo.variationKey + "";
heap.addUserProperties({
experimentKeyString:experimentVarString
})
}
}
}
optimizelyClientInstance.notificationCenter.addNotificationListener(optimizelySdk.enums.NOTIFICATION_TYPES.DECISION, heapDecision);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment