Skip to content

Instantly share code, notes, and snippets.

@jacopo-nosto
Created November 23, 2017 10:17
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jacopo-nosto/cc0d8a6ed5d4e0e570db3fb63d556493 to your computer and use it in GitHub Desktop.
Save jacopo-nosto/cc0d8a6ed5d4e0e570db3fb63d556493 to your computer and use it in GitHub Desktop.
Popup attribution from Mailchimp form
doc.find("#takeMeThere").click(function(){
_targetWindow.nostojs(function(api){
var cookie = api.internal.overlay.discountPopup.instance.readCookie(<POPUP_CAMPAIGN_ID>);
if (cookie && !cookie.coupon) {
api.internal.overlay.discountPopup.instance.writeCookie(<POPUP_CAMPAIGN_ID>, "coupon", <COUPON_CODE>);
api.internal.couponGiven(<POPUP_CAMPAIGN_ID>, <COUPON_CODE>);
api.customer({
email: <EMAIL>,
newsletter: true,
source: 'discount-popup',
source_id: <POPUP_CAMPAIGN_ID>
});
}
_targetWindow.location = "redirect_url";
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment