Skip to main content
Solved

Meta Pixel to track Klaviyo submissions


Forum|alt.badge.img

Hi there, 

I’m trying to set up my Meta Pixel to track when someone submits a Klaviyo sign-up form on my shop. I’ve already read all the community topics about this and followed their instructions, but it’s not working.

I’ve added the following code to theme.liquid just about </body> on my Shopify store, but Meta is not tracking form submissions. Am I missing a step? Do I need to add something to Klaviyo itself or to Meta’s ad manager? 

 <script>
window.addEventListener("klaviyoForms", function(e) { 
  if (e.detail.type == 'submit') {
<!-- Meta Pixel Code -->
<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', 'ID REMOVED BUT IT WOULD BE HERE');
fbq('track', 'Lead');
</script>
<noscript><img height="1" width="1" style="display:none"
src="https://www.facebook.com/tr?id=ID REMOVED BUT IT WOULD BE HERE&ev=Lead&noscript=1"
/></noscript>
<!-- End Meta Pixel Code -->
 } }); </script>

Thanks for your help!

Best answer by Ojuade Peace

Sure! Here's a simpler version:

 

It looks like you're almost there, but here are a few things to check to make sure your Meta Pixel tracks the Klaviyo sign-up form submission:

 

1. Pixel Code Placement:  

Make sure the Meta Pixel code is placed correctly in your Shopify theme file just before the `</body>` tag. Double-check that the code is fully intact.

 

2. Form Trigger:  

Ensure the Klaviyo form submission event is firing properly. You can check your browser's console (press `F12`) to see if there are any errors.

 

3. Correct Pixel ID:  

Check that the Pixel ID in the Meta code is correct. You can find your Pixel ID in Meta Ads Manager.

 

4. Updated Script:  

Try this version of the code. It makes sure the Meta Pixel fires when the form is submitted:

 

```html

<script>

window.addEventListener("klaviyoForms", function(e) {

    if (e.detail.type == 'submit') {

        fbq('track', 'Lead');

    }

});

</script>

```

 

5. Check Meta Pixel in Ads Manager:  

Go to Meta Ads Manager and ensure your Pixel is set up correctly and actively tracking events. You can also use the Pixel Helper Chrome Extension to check if the Pixel is firing correctly.

 

6. Debugging:  

To see if the form is actually being submitted, you can add a simple log to the script like this:

```javascript

window.addEventListener("klaviyoForms", function(e) {

  if (e.detail.type == 'submit') {

    console.log('Form submitted'); // This will tell you if the form is being submitted

    fbq('track', 'Lead');

  }

});

```

 

This will show in your browser's console when the form is submitted.

 

7. Klaviyo Settings:  

Double-check that your Klaviyo form is set up to track submissions properly.

 

If none of this works, try contacting Meta support or Klaviyo support for more help. Let me know if you need more guidance!

View original
Did this topic or the replies in the thread help you find an answer to your question?

3 replies

Forum|alt.badge.img+2
  • Problem Solver II
  • 17 replies
  • Answer
  • March 15, 2025

Sure! Here's a simpler version:

 

It looks like you're almost there, but here are a few things to check to make sure your Meta Pixel tracks the Klaviyo sign-up form submission:

 

1. Pixel Code Placement:  

Make sure the Meta Pixel code is placed correctly in your Shopify theme file just before the `</body>` tag. Double-check that the code is fully intact.

 

2. Form Trigger:  

Ensure the Klaviyo form submission event is firing properly. You can check your browser's console (press `F12`) to see if there are any errors.

 

3. Correct Pixel ID:  

Check that the Pixel ID in the Meta code is correct. You can find your Pixel ID in Meta Ads Manager.

 

4. Updated Script:  

Try this version of the code. It makes sure the Meta Pixel fires when the form is submitted:

 

```html

<script>

window.addEventListener("klaviyoForms", function(e) {

    if (e.detail.type == 'submit') {

        fbq('track', 'Lead');

    }

});

</script>

```

 

5. Check Meta Pixel in Ads Manager:  

Go to Meta Ads Manager and ensure your Pixel is set up correctly and actively tracking events. You can also use the Pixel Helper Chrome Extension to check if the Pixel is firing correctly.

 

6. Debugging:  

To see if the form is actually being submitted, you can add a simple log to the script like this:

```javascript

window.addEventListener("klaviyoForms", function(e) {

  if (e.detail.type == 'submit') {

    console.log('Form submitted'); // This will tell you if the form is being submitted

    fbq('track', 'Lead');

  }

});

```

 

This will show in your browser's console when the form is submitted.

 

7. Klaviyo Settings:  

Double-check that your Klaviyo form is set up to track submissions properly.

 

If none of this works, try contacting Meta support or Klaviyo support for more help. Let me know if you need more guidance!


Forum|alt.badge.img
  • Author
  • Contributor I
  • 1 reply
  • March 15, 2025

Hi Ojuade,

That simper code worked! Thank you so much.

For anyone else looking for help with this issue. I used Ojuade’s shorter code before the </body> tag and the full Meta Pixel code in the <head> tag in theme.liquid. 


Forum|alt.badge.img+2
  • Problem Solver II
  • 17 replies
  • March 15, 2025

You are welcome 

You can always get back to me whenever you have another issue 

Whatsapp number +2349028546638