Skip to content

Instantly share code, notes, and snippets.

@jtsternberg
Last active September 1, 2020 22:09
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 jtsternberg/23957786e3e9b6d3c6cb888f1eeba718 to your computer and use it in GitHub Desktop.
Save jtsternberg/23957786e3e9b6d3c6cb888f1eeba718 to your computer and use it in GitHub Desktop.
send arbitrary to the webhook via the debugInfo field
<script>
document.addEventListener('om.Optin.init.submit', function( evt ) {
// Only do this for a specific campaign
if ( '<slug>' !== evt.detail.Campaign.id ) {
return;
}
var meta = { products_form: jQuery(document.forms.products_form).serialize() };
// Add the meta field to the Optin fields data.
evt.detail.Optin.data.fields.meta = JSON.stringify( meta )
} );
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment