Created
September 17, 2024 23:35
-
-
Save ericakfranz/762f61e49c56e4ea5220bf939c9658f5 to your computer and use it in GitHub Desktop.
Show only one OptinMonster campaign per page visit regardless of campaign type.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<script> | |
/** | |
* Limit OptinMonster Campaigns | |
* @author Erica Franz | |
* @url https://fatpony.me | |
* @desc Show only one OptinMonster campaign per page visit regardless of campaign type. | |
*/ | |
// Run this script when the first Campaign is shown | |
document.addEventListener('om.Campaign.afterShow', function(event) { | |
// Locate and remove only empty HTML placeholders for campaigns | |
document.querySelectorAll('[id^=om-][id$=-holder]:empty').forEach(e => e.remove()); | |
} ); | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment