Skip to content

Instantly share code, notes, and snippets.

@EverettBerry
Created July 31, 2022 00:41
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 EverettBerry/76af3bf53f0614434b4356af573e8e29 to your computer and use it in GitHub Desktop.
Save EverettBerry/76af3bf53f0614434b4356af573e8e29 to your computer and use it in GitHub Desktop.
<script type="text/javascript">
function Subscribe(){
var validRegex = /^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9-]+(?:\.[a-zA-Z0-9-]+)*$/;
var email = document.getElementById("mce-EMAIL-2");
let ms = Date.now()/1000;
message_pop = document.getElementById("messagepop");
if (email.value.match(validRegex)) {
_cio.identify({
id:ms*1000,
email: email.value,
created_at: ms,
})
message_pop.innerHTML ="{{t '🎉 Awesome! Thanks for subscribing.'}}";
email.value="";
} else {
message_pop.innerHTML = "Invalid email address";
message_pop.style.color="red";
email.value="";
return false;
}
};
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment