Skip to content

Instantly share code, notes, and snippets.

@yosemsweet
Created February 28, 2014 01:02
Show Gist options
  • Save yosemsweet/9263084 to your computer and use it in GitHub Desktop.
Save yosemsweet/9263084 to your computer and use it in GitHub Desktop.
Rooster - Apply Discount on Interaction
<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