Skip to content

Instantly share code, notes, and snippets.

@ericakfranz
Created March 11, 2022 19:26
Show Gist options
  • Save ericakfranz/1442ee2996836d8e88bda67fd6123415 to your computer and use it in GitHub Desktop.
Save ericakfranz/1442ee2996836d8e88bda67fd6123415 to your computer and use it in GitHub Desktop.
Autofill the optin email field and hide it. Specifically for use with gamified (spinning wheel) campaigns to allow spinning the wheel without collecting an email.
document.addEventListener('om.Campaign.afterShow', function(event) {
// Replace YOUR_DUMMY_EMAIL with the email address you want to autofill the field with.
// A validly formatted email address is required here.
var emailValue = "YOUR_DUMMY_EMAIL";
document.getElementById("{{ns}}-field-email").value = emailValue;
});
/* Hide the email field */
html div#om-{{id}} #{{ns}}-field-email { opacity: 0; height: 0; visibility: hidden; }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment