Created
December 2, 2019 21:57
-
-
Save jtsternberg/4a18b4672b013d4e7c3a323345d69202 to your computer and use it in GitHub Desktop.
Add pinterest no-pin data attribute to OptinMonster-loaded images
This file contains 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 type="text/javascript"> | |
document.addEventListener('om.Campaign.load', function(event) { | |
var slug = event.detail.Campaign.id; | |
var images = document.querySelectorAll('#om-' + slug + ' img'); | |
if ( images ) { | |
images.forEach(function(el) { | |
el.setAttribute('data-pin-nopin', true); | |
}); | |
} | |
}); | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment