Created
February 28, 2014 01:02
-
-
Save yosemsweet/9263084 to your computer and use it in GitHub Desktop.
Rooster - Apply Discount on Interaction
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
<script> | |
function onInteraction(e) { | |
// Run the discount code here. | |
// Important - interaction events can happen multiple times with a given overlay so | |
// you'll want to ensure the discount is only applied once. | |
} | |
$(window).on('message', function(e) { | |
// Make sure the message is coming from Rooster | |
if (e.originalEvent.origin + '/' !== window.location.protocol + _GT_config.gt_host) { | |
return; | |
} | |
switch (e.originalEvent.data) { | |
case "gt_interaction_popup": | |
return onInteraction(e.originalEvent); | |
} | |
}); | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment