Skip to content

Instantly share code, notes, and snippets.

@jtsternberg
Created December 2, 2019 21:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jtsternberg/4a18b4672b013d4e7c3a323345d69202 to your computer and use it in GitHub Desktop.
Save jtsternberg/4a18b4672b013d4e7c3a323345d69202 to your computer and use it in GitHub Desktop.
Add pinterest no-pin data attribute to OptinMonster-loaded images
<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