Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save robisatthefunction/4fee6ed6638488d90dc7a071032014fc to your computer and use it in GitHub Desktop.
Save robisatthefunction/4fee6ed6638488d90dc7a071032014fc to your computer and use it in GitHub Desktop.
const onDecision = ({ type, userId, attributes, decisionInfo }) => {
// Check if a decision event was dispatched
if (decisionInfo['decisionEventDispatched']) {
// Get experiment bucketing info
const experimentKey = decisionInfo['ruleKey']
const variationKey = decisionInfo['variationKey']
const decisionString = '('+experimentKey+'):('+variationKey+')';
// Sends decision info through eVar2
window.s.eVar2 = decisionString;
window.s.tl(true, "o", "OptimizelyDecision");
}
const notificationId = optimizelyClient.notificationCenter.addNotificationListener(enums.NOTIFICATION_TYPES.DECISION, onDecision);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment