Last active
October 28, 2020 01:16
-
-
Save jtsternberg/f24338ec0d4bbbb507c53b6c91bd1a77 to your computer and use it in GitHub Desktop.
Runs after the campaign rule-check runs. Can be used to prevent the showing of a campaign even if rules pass.
This file contains 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
document.addEventListener('om.DisplayRules.afterRun', function(event) { | |
var DisplayRules = event.detail.DisplayRules; | |
var Campaign = event.detail.Campaign; | |
if ( 'YOUR-CAMPAIGN-ID' === Campaign.id && DisplayRules.show ) { | |
if ( 'pepperoni' !== window.pizza ) { | |
// Only allow rules to pass if pizza variable exists | |
// and it's value is 'pepperoni'. | |
DisplayRules.show = false; | |
} | |
} | |
} ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment