Solved

Using Facebook Pixel To Track Klaviyo Submissions in Shopify

  • 7 December 2023
  • 1 reply
  • 271 views

Badge

Hi there, I've read everywhere and I'm really unsure how to set this up.

I have already installed my Pixel through the Facebook and Instagram Sales Channel App on Shopify. I have ran campaigns before on Facebook  and all has worked well.

I am trying to run a campaign to optimise for Klaviyo sign ups and therefore would like to use my pixel to track the sign ups submissions on site.

To do this I have added my pixel code to theme.liquid in the header section:

 <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',
'https://connect.facebook.net/en_US/fbevents.js');
fbq('init', '335819078856330');
fbq('track', 'PageView');
</script>
<noscript
><img
height="1"
width="1"
style="display:none"
src="https://www.facebook.com/tr?id=335819078856330&ev=PageView&noscript=1"
></noscript>

 

Which I'm not sure why I should have to be honest if the pixel has already been set up through the app. 

 

I also added the Klaviyo call code at the bottom of my theme.liquid file

 


</script>
{% endif %}
<script>
window.addEventListener("klaviyoForms", function(e) {
if (e.detail.type == 'submit') {
fbq('track', 'Lead');
}
});
</script>

This I am sure would track every submit event and call it Lead to the Pixel.
Now running test data - it hasn't captured a single lead. In my Meta dashboard, the standard event of Lead isn't even appearing.

I am so confused, and unsure what to do.

Please help!

Thanks in advance.

icon

Best answer by Taylor Tarpley 8 December 2023, 21:45

View original

1 reply

Userlevel 7
Badge +60

Hi there @aguimansilla

 

Welcome to the Community! Thanks for sharing your question with us, happy to help! 

 

Do you mind adding trying this version of the second code you shared, and where it says ‘Add FB tracking code here’, add in your FB tracking pixel. I believe this might be why you’re running into issues! 

<script>
window.addEventListener("klaviyoForms", function(e) {
if (e.detail.type == 'submit') {
// add Facebook tracking pixel code here
}
});
</script>

 

I’d also suggest checking out these similar threads in the Community to gain more insight! 

https://community.klaviyo.com/integrations%2Dand%2Dreviews%2D39/tracking%2Dklaviyo%2Dform%2Dsubmission%2Don%2Dshopify%2Das%2Dfacebook%2Dlead%2Devent%2D2845

 

Thanks for participating in the Community! 

-Taylor 

Reply