How to Redirect Visitor When Campaign is Closed

OptinMonster’s Javascript Events API allows us to extend the functionality of campaigns to suit a number of custom needs.

While you can configure a Redirect URL for the campaign when successfully submitted through the campaign builder, you can also redirect the visitor when the campaign is closed following this guide should you have a specific need for this functionality.

Any Javascript can be added to the or footer of your site.

Remember to place your code in <script> tags, for example:
&lt;img src=&quot;data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7&quot; data-wp-preserve=&quot;%3Cscript%20type%3D%22text%2Fjavascript%22%3E%0A%20%20%20%2F%2F%20Your%20JavaScript%20here..%0A%3C%2Fscript%3E&quot; data-mce-resize=&quot;false&quot; data-mce-placeholder=&quot;1&quot; class=&quot;mce-object&quot; width=&quot;20&quot; height=&quot;20&quot; alt=&quot;&amp;amp;lt;script&amp;amp;gt;&quot; title=&quot;&amp;amp;lt;script&amp;amp;gt;&quot; /&gt;

Redirect All Campaign on Close

Redirect the visitor to a specific URL when any campaign on the site is closed.

Replace http://optinmonster.com with your own redirect url.

Redirect Specific Campaign on Close

Redirect the visitor to a specific URL when a specific campaign on the site is closed. Replace http://optinmonster.com with your own redirect url, and YOUR_OPTIN_SLUG_HERE with the slug of your campaign.


FAQs

Q: What about Custom HTML Integrations or Canvas?

A: The Custom HTML integration and Canvas are able to use this as long you have the om-trigger-conversion class applied. Follow our guide on using the custom conversion class with Custom HTML integrations or with Canvas campaigns.