Created
March 9, 2021 03:25
-
-
Save robisatthefunction/b50447587d616d357d72d66c15d1379c 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
| /* This snippet runs everytime a "campaign decision" is made. */ | |
| var decisionObject = window.optimizely.get('state').getDecisionObject({ | |
| campaignId: campaignId, | |
| shouldCleanString: true | |
| }); | |
| //Check to see if a decision has been made. This will be null if the user is part of the holdback group | |
| if (decisionObject) { | |
| var experimentId = decisionObject.experiment.split(' ')[1].replace(/[()]/g, ''); | |
| var variationId = decisionObject.variation.split(' ')[1].replace(/[()]/g, ''); | |
| try { | |
| _pxam.push({ | |
| type: 'event', | |
| eventType: 'change', | |
| eventSource: 'field', | |
| feature: 'Optimizely Campaign', | |
| label: experimentId + ‘ > ‘ + variationId | |
| }); | |
| } | |
| catch(e) { | |
| } | |
| /*//Back up Optimizely event to see if things work | |
| window.optimizely.push({ | |
| "type": "event", | |
| "eventName": "integrationSuccess" | |
| });*/ | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment