OptinMonster allows you to use any Email Service Provider or fully customize your campaign forms using our Custom HTML Campaign Form integration option. Now you can easily set cookies and track conversions when using a custom html form.
In order to facilitate this, there is a special class that you can use to notify OptinMonster that a conversion has happened. All you need to do is add the class
om-trigger-conversion to the custom html form’s submit button.
<form method="POST" src="http://www.example.com/form.php"> <input type="text" placeholder="First Name" /> <input type="email" placeholder="Email Address" /> <input type="submit" class="om-trigger-conversion" value="Submit Now!" /> </form>
This lets us know that a conversion has taken place when the visitor selects the submit button in your custom HTML form, and also sets a cookie if you’ve specified a Cookie Duration value for your campaign.
We hope this guide helped you track conversions when using a custom HTML form. You may also want to check out our tracking conversions in Canvas documentation to setup conversion tracking with our Canvas Technology!
Q: Why does my campaign not close automatically after submission?
A: For most users, their form’s redirect action renders this a non-issue. However, if your code keeps the web visitor on the same page, then you will need to add an additional class to your input. You will need to add the
What this means is your Submit input button will now have 2 custom classes: (1) the
om-trigger-conversion to track a conversion when the button is pressed, and (2) the
om-trigger-close to close the campaign modal popup when the conversion data has been submitted.
Your input button could look something like the example below:
<input type="submit" class="om-trigger-conversion om-trigger-close" value="Sign me up!" />
Q: Is there a way track a conversion but not track cookies and run the success event?
A: Yes, if you don’t want any cookies set for an alert such as a floating bar that shows information, you use Custom HTML. However, for tracking conversions this way, you will add the class
om-trigger-alt-conversion. So a link could look like:
<a href='https://optinmonster.com' class='om-trigger-alt-conversion'>Check out OptinMonster!</a>
This class will also bypass the success function and not set cookies as well, including not setting any global cookies, etc.