Solved

Facebook Event Manager doesn't work with Klaviyo? How to manually do it on Shopify?

  • 7 August 2021
  • 5 replies
  • 457 views

Badge +1

I saw a previous post going over something similar but I didn’t understand the solution. Thought it would be as simple as throwing this code into the theme folder but I don’t see it working. I already have the pixel installed by shopify so it’s on every page. I’m not a developer but it seems like it should be pretty easy but I’m just not getting it to work. Any ideas?

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

 

icon

Best answer by julie.accardo 7 August 2021, 19:45

View original

5 replies

Userlevel 5
Badge +30

Hi @MilovanC,

 

While we don’t necessarily have a prebuilt integration with Facebook Event Manager, my understanding is that this tool is used to track user activity on your website. Few things come to mind….

  1. You can set up web tracking on your Shopify store so that you can see what items people are looking at as well as when they are active on your website. 
  2. We do have the ability to integrate with Facebook advertising so that you can create lookalike audiences or target FB ads to these users OR route subscribers that opt-on through lead ad forms to your mailing list in Klaviyo. 

Hope you have a great weekend!

Julie

Badge +1

I am trying to do the same thing.

I would like to setup a Facebook conversion event for when a customer submits a Klaviyo form. I thought about using the same code that you have, but it doesn’t seem to be working.

@MilovanC Did you find a solution?

Userlevel 6
Badge +50

Hi @eferguson

 

Welcome to the Community! 

 

Do mind providing a link to the ‘previous post’ you referenced? It might be handy to see how they troubleshooted a similar situation!  

 

As @julie.accardo mentioned, we do not have a pre-built integration for creating a Facebook Event to automatically sync to your Klaviyo account. However, a potential workaround to this would be what @MilovanC discovered. When using a Klaviyo Form, you can create Custom Javascript to Add to Our Form to Create an Event Listener. You will need to add the basecode for this custom JS between the <head> tags on your website and once the base code has been installed, you can run functions such as fbq('track', 'PageView') , which is the Facebook pixel tracking method. That is what you'll want to include inside of our script where it says to add the pixel and you'd want to tweak this method according to your needs. 

 

However, this is the extent that we is able to help you, as you will need to follow these instructions provided by Facebook on installing your basecode and reach out to Facebook with any other troubleshooting needs or further testing as we can only provide you with information on what's needed to trigger the Facebook pixel when a Klaviyo form is submitted. 

 

I am unsure of how the Facebook base pixel interacts with our code, but it is worth mentioning that according to the code in our Help Center Article, you might be missing two additional curly brackets ‘ }} ’ before your ending ‘ ); ’ . This might not be an issue, but wanted to point it out! 

 

Let us know if after inserting the brackets or connecting with Facebook Support you are able to make this feature work! It would be helpful for other Community users to know in the future! 

 

Best,

Taylor 

I’m with you all, I can’t get it to work either - I’m using the CompleteRegistration event instead of the Lead event, but I am not getting it to trigger either.

Technically, we shouldn’t need to do anything on facebook events manger, right? It should automatically show up in events as long as the pixel is tracking and events are working (for me, page views and other events are working in FB events)

Here’s what I have:

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

@MilovanC @eferguson did you  get this to work?

OMFG I just got it to work…

The PROBLEM for me was that the APOSTROPHE was not an APOSTROPHE!!! it was, slightly curved and was a different glyph!!! I barely caught it. Now it works.

 

Also, for your code @MilovanC , you need to close out your script - notice the } }); at the end below right before the </script> … the “(“ opens before “klaviyoForms”, the “{“ before “if”, and the other “{“ before fbq… so you need to close all those up, and end with a “;”

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

Reply