Created
November 23, 2017 10:17
-
-
Save jacopo-nosto/cc0d8a6ed5d4e0e570db3fb63d556493 to your computer and use it in GitHub Desktop.
Popup attribution from Mailchimp form
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
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