Home » Javascript » Pinterest tag firing multiple times on single page app

Pinterest tag firing multiple times on single page app

Posted by: admin June 30, 2018 Leave a comment

Questions:

I am using the pinterest tag code out of the box on a single page app, and it fires multiple times on navigation. Any suggestions on how to make if fire only once?

<script type="text/javascript">
!function(e){if(!window.pintrk){window.pintrk=function(){window.pintrk.queue.push(Array.prototype.slice.call(arguments))};var n=window.pintrk;n.queue=[],n.version="3.0";var t=document.createElement("script");t.async=!0,t.src=e;var r=document.getElementsByTagName("script")[0];r.parentNode.insertBefore(t,r)}}("https://s.pinimg.com/ct/core.js");

pintrk('load','<YOUR_TAG_ID>', {
  em: '<email_address>',
});
pintrk('page');
</script>
Answers: