I have a working facebook pixel that is tracking the audience on my website.
<script>
!function(f,b,e,v,n,t,s){if(f.fbq)return;n=f.fbq=function(){n.callMethod?
n.callMethod.apply(n,arguments):n.queue.push(arguments)};if(!f._fbq)f._fbq=n;
n.push=n;n.loaded=!0;n.version='2.0';n.queue=[];t=b.createElement(e);t.async=!0;
t.src=v;s=b.getElementsByTagName(e)[0];s.parentNode.insertBefore(t,s)}(window,
document,'script','//connect.facebook.net/en_US/fbevents.js');
fbq('init', 'myID');
fbq('track', "PageView");</script>
<noscript><img height="1" width="1" style="display:none"
src="https://www.facebook.com/tr?id=myID&ev=PageView&noscript=1"
/></noscript>
Ok, so this is working fine. Now my question is, how to set up this code, so i'll track
I would also need help with creating custom pixel in facebook panel (https://business.facebook.com/ads/manager/pixel/facebook_pixel/), because i really dont know which event to choose, and where to get code for that custom pixel.
As far as i got with my research, you have to insert fbq('track', 'Lead') somewhere in above pixel code, but i still have no idea, how to link that to submit button and how to get all this data to my facebook development panel.
Thank you for all your answers, Luka.
You can do that by adding an event within the button. As you already have your base code set up and working, you just need to add the standard event code:
<button onClick="fbq('track', 'Purchase');">Button Text</button>
If you prefer, you can create a function that triggers the event:
<script>
function onClick() {
fbq('track', 'Purchase');
};
</script>
And then call it, to fire the event when clicking the button:
<button onClick="onClick()">Buy Now</button>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With