OptinMonster Logo

OptinMonster Documentation

Documentation, Reference Materials, and Tutorials for OptinMonster

Home

Docs

How to Redirect Visitor When Campaign is Closed

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.

In this article, we’ll provide some examples of how to use the Javascript Events API to redirect campaigns on close.

Before You Start

Here are some things to know before you begin:

  • This guide is intended only for advanced users with technical knowledge. No support is provided for customizing or troubleshooting the examples provided.
  • You can use the options within the campaign builder to redirect the visitor when the campaign is submitted. This guide should be used only if you have a specific need for it.
  • This guide provides examples that may need to be modified to meet your specific needs.
  • Javascript can be added to the header or footer of your site.
  • Be sure to place all Javascript code within <script> tags on your site.

Examples

Redirect All Campaign on Close

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

Replace https://staging.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 https://staging.optinmonster.com with your own redirect url, and YOUR_OPTIN_SLUG_HERE with the slug of your campaign.

Troubleshooting

What about Custom HTML Integrations?

If you are using a Custom HTML Integration for your campaign, be sure to add the class om-trigger-conversion to the submit button of your custom form.

For more details, see our guide on using the custom conversion class with Custom HTML integrations.


Still stuck?

How can we help?

Last updated on


Start Getting More
Leads & Sales Today
with OptinMonster!

Popups work, and you can get started for a few bucks a month. What are you waiting for?

Create and launch smart capture forms
today in minutes. What are you waiting for?