OptinMonster Documentation

Documentation, Reference Materials, and Tutorials for OptinMonster

Home

Docs

How to Trigger MonsterLinks on Hover

How to Trigger MonsterLinks on Hover

Do you want to extend the functionality of MonsterLinks so they trigger the appearance of a campaign on hover instead of click? It’s easy with our JavaScript events API!

In this article, you will learn how to trigger MonsterLinks when the visitor hovers over a page element.

Before You Start

Here are some things to know before you begin:

  • All examples in this guide require that you add both the MonsterLink and related campaign embed code to your page before they can function.
  • Any Javascript can be added to the <head> or footer of your site.
  • Remember to place your code in <script> tags, for example:
<script type="text/javascript">
   // Your JavaScript here..
</script>

Trigger MonsterLink on Hover

Trigger the appearance of a campaign when hovering over it’s MonsterLink.

jQuery(document).ready(function($){
	// Change 'rt78pcbzrddo1y7w0yq3' to match your specific campaign slug
	var campaignSlug = 'rt78pcbzrddo1y7w0yq3';

	$('body').on('mouseover', '[href="https://app.monstercampaigns.com/c/' + campaignSlug + '/"]', function() { 
		window['om' + campaignSlug].startShow();
	});
});

Trigger Specific MonsterLink on Hover of a Specific Element

Trigger the appearance of a campaign when hovering over a specific element on the page that is not a MonsterLink.

Replace .content in the following example with the class of the element you want to trigger a MonsterLink on when hovered over.

Also, replace u6mkwuqm0xf6g94d with your own campaigns unique slug you used when creating the MonsterLink.

jQuery(document).ready(function($){
	// Change 'rt78pcbzrddo1y7w0yq3' to match your specific campaign slug
	var campaignSlug = 'rt78pcbzrddo1y7w0yq3';

	// When hovering over any element with the '.content' class - change as you require
	$('.content').on('mouseover', function() {
		window['om' + campaignSlug].startShow();
	});
});

Trigger the appearance of a campaign when hovering over any link containing the rel attribute external.

Replace u6mkwuqm0xf6g94d with your own campaign’s unique slug you used when creating the MonsterLink.

jQuery(document).ready(function($){
	// Change 'rt78pcbzrddo1y7w0yq3' to match your specific campaign slug
	var campaignSlug = 'rt78pcbzrddo1y7w0yq3';

	// When any link contains 'external' in the rel attribute
	$('a[rel*=external]').on('mouseover', function() {
		window['om' + campaignSlug].startShow();
	});
});

Still stuck?

How can we help?

Last updated on


Start Getting More Leads & Sales Today with OptinMonster!

Start Getting More
Leads & Sales Today
with OptinMonster!

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

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

OptinMonster has transformed our business. Before integrating their optins, our clients saw a 2% conversion rate from web traffic, which is slightly above the standard for their industry. With the integration of OptinMonster’s lightbox popup, exit-intent technology, split testing, and other tools, our client’s conversion rates soared by an unprecedented 500%. They attracted substantially more customers while spending less on digital advertising. Their success propelled them to the top of their markets, outperforming national chains and other medical spas with much bigger marketing budgets. Our client’s success in their market has distinguished us in our own. We are now one of the most sought-after marketing firms in the industry of aesthetic medicine. We know that the integration of OptinMonster, more than any other tool or marketing strategy, has supported this growth and achievement.

chris zelig medstar media

Chris Zelig

Partner, Medstar Media

OptinMonster has been a game-changer for us. From driving donations to collecting new leads, there is nothing that this simple tool has failed to accomplish. Our lead collection rate has jumped by over 1,000%.

joe lowe american bird conservancy

Joe Lowe

Director of Digital Communications, American Bird Conservancy

Through OptinMonster’s exit-intent popups, we have more than doubled our sales conversion rate. Best of all is the compound effect of using OptinMonster over a long period of time—more conversions mean more customers, which means more word of mouth.

mitch smith, managing director, shockbyte

Mitch Smith

Managing Director, Shockbyte.com