Hi,
I am trying to set up a Pinterest Pixel to track when a specific button is clicked on the website. In the Launch Rule I've set it up as a core-click for the button and for the event action I have set it to custom code and under editor I'm using this script I got from the Pinterest Developer website.I have my Pinterest ID to put into the code I just left it out in the example below:
<script>
pintrk('track', 'custom');
</script>
<noscript>
<img
height="1"
width="1"
style="display:none;"
alt=""
src="https://ct.pinterest.com/v3/?tid=YOUR_TAG_ID&event=custom&noscript=1"
/>
</noscript>
What else am I missing in order for the Pixel to fire correctly when the button is clicked?
Thanks.
Solved! Go to Solution.
Views
Replies
Total Likes
Do you have the base Pinterest Pixel script installed on the site?
I have Pinterest pixels installed on our sites entirely through Launch...
The first thing I have is:
!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");
Basically, I first check if the pintrk object exists.. if not, I add the script to the site.
Next, now I have to run a config event (this happens on all pages)
// I have a variable set eaelier with my ID value, then so it's easier to adjust globally if needed
pintrk('load', pinterestPixelId);
This now configures the pintrk object with our pinterest id
Now I fire our standard Page View event:
pintrk('page');
Once the above is all working, and you have a properly configured pintrk object, you should be able to fire pixels with your clicks...
pintrk('track', 'custom');
There's not much need to code the noscript portion of the code... you are using JS to trigger all this.. if JS is disabled those no scripts won't be available either.
This is all assuming that you are doing ALL the Pinterest work in Launch.. if the Pinterest Script and Config is set up on the base code of your site you may not need all of this...
Are you getting any errors?
Views
Replies
Total Likes
Do you have the base Pinterest Pixel script installed on the site?
I have Pinterest pixels installed on our sites entirely through Launch...
The first thing I have is:
!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");
Basically, I first check if the pintrk object exists.. if not, I add the script to the site.
Next, now I have to run a config event (this happens on all pages)
// I have a variable set eaelier with my ID value, then so it's easier to adjust globally if needed
pintrk('load', pinterestPixelId);
This now configures the pintrk object with our pinterest id
Now I fire our standard Page View event:
pintrk('page');
Once the above is all working, and you have a properly configured pintrk object, you should be able to fire pixels with your clicks...
pintrk('track', 'custom');
There's not much need to code the noscript portion of the code... you are using JS to trigger all this.. if JS is disabled those no scripts won't be available either.
This is all assuming that you are doing ALL the Pinterest work in Launch.. if the Pinterest Script and Config is set up on the base code of your site you may not need all of this...
Are you getting any errors?
Views
Replies
Total Likes
Thank you so much for the detailed explanation!
Views
Replies
Total Likes
You're welcome
If you still have issues, we can look at errors in your Browser Console... I suspect though that it was actually pintrk is not defined which is what happens if you haven't added the script and configured the pixel (sometimes this could also be due to a timing issue - if the code is there, but you try to fire the event before the pixel is fully configured)
Views
Replies
Total Likes
You were a huge help, thanks so much again