Last active
July 16, 2025 22:19
-
-
Save robisatthefunction/4fee6ed6638488d90dc7a071032014fc to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const onDecision = ({ type, userId, attributes, decisionInfo }) => { | |
| // Check if a decision event was dispatched | |
| if (decisionInfo && decisionInfo.decisionEventDispatched) { | |
| // Get experiment bucketing info | |
| const experimentKey = decisionInfo.ruleKey; | |
| const variationKey = decisionInfo.variationKey; | |
| // Format decision string as "(experiment):(variation)" | |
| const decisionString = `(${experimentKey}):(${variationKey})`; | |
| // Send decision info through Adobe Analytics eVar2 | |
| // You may want to add code that waits for the s variable to be available | |
| if (window.s) { | |
| window.s.eVar2 = decisionString; | |
| window.s.tl(true, 'o', 'OptimizelyDecision'); | |
| } | |
| } | |
| }; | |
| // Register the decision listener with Optimizely | |
| 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