Intro
A custom trigger allows you to display a popup or flyout form only when a predefined action occurs on your website, such as a button click or a custom event.
Info
Omnisend forms, including custom triggered forms, require the Omnisend Javascript snippet.
If you already have connected your store with Omnisend - you have already added this snippet.
Custom trigger
Omnisend form will be displayed when this sample javascript is executed:
window.omnisend = window.omnisend || [];
window.omnisend.push(['openForm', '1a2b3c4d5e6f7g8h9']);
'1a2b3c4d5e6f7g8h9' in this example is unique Omnisend form identifier. It is automatically generated when the form is created in Omnisend and will be different for your form.
Example of a button-triggered Form
The following is an example of how to trigger your form to open on clicking a button:
<button class="button" onclick="openOmnisendForm()">Subscribe now</button>
<script>
function openOmnisendForm() {
window.omnisend = window.omnisend || [];
window.omnisend.push(['openForm', '1a2b3c4d5e6f7g8h9']);
}
</script>
'1a2b3c4d5e6f7g8h9' in this example is unique Omnisend form identifier. It is automatically generated when the form is created in Omnisend and will be different for your form.
Testing the form trigger
After embedding the code, visit your store and perform the trigger action (e.g. click the button) to ensure the form displays correctly.
Need help?
Read more about custom trigger for Omnisend form in our knowledge base.
Don't be afraid to contact us. We are always ready to help!