How can I track a profile that has clicked on a Facebook Ad?

  • 17 November 2020
  • 4 replies

Userlevel 1
Badge +1

I know there’s a way to do this via a lead form, but what if you just clicked on an ad? Is there some combination of Facebook Pixel, Klaviyo.js/cookie that would allow this to work? Happy to do any amount of custom integration needed.





Best answer by k.mcevoy 23 November 2020, 16:46

View original

4 replies

Userlevel 4
Badge +5

Hi Michael, 


Thanks for reaching out! Klaviyo will automatically capture any UTM parameters that initially brought a customer to your site via the “Initial Source” profile property. This article details how you can use that property to create segments for campaign sends or to trigger flows. 


That being said, this will only capture the initial action that led your customer to your website. If you wanted to track a click on a Facebook Ad at any point in their journey you can leverage the Track API to create a custom event. More information on that here


Please let me know if you have any further questions and I would be happy to help!



Userlevel 1
Badge +1

Kelsey, thanks so much. That may be what I’m looking for. Are you saying that I can call hit the Klaviyo api (track) from the Facebook side?

Userlevel 4
Badge +5

Hey Michael, 


Apologies if I wasn’t clear on my initial response, let me clarify. If the Ad is on Facebook it’s not possible to send an event to Klaviyo. This would require us to write code in Facebook to send an event when that click happens, and unfortunately we don’t have access to do that. 


However, if the Ad was on your website and you wanted to track customers who clicked on that Ad and were redirected to another page on your site to make a purchase, it might be possible. 


If the Ad is in an iframe it won’t be possible because we can’t add event listeners in the DOM based on something that is inside of an iframe, and thus can’t trigger that API call. But if the Ad is just an image they can click then it would be possible! If you would like to link me to a page on your site where the ad is located I can take a closer look.


Let me know if this helps or if you have any further questions!



Userlevel 7
Badge +49

Agree with all the above about using UTM parameters as the most practical way track inbound traffic from Facebook Ads.  That would work if it’s their First Visit or their most Recent Visit (anything in between may be harder to determine).  

If you need more granular tracking across a time series (clicked on Ad 1, clicked on Ad 2, etc), I recommend you write a simple custom event that basically does the same thing as the native UTM tracking of Klaviyo, but passed into Klaviyo as an Event (as opposed to custom properties in the profile).  

var _learnq = _learnq || [];
_learnq.push(['track', 'Visited with UTM', {
'UTM_Campaign' : //get.utm_campaign
'UTM_Medium' : //get.utm_campaign
'UTM_Source' : //get.utm_source
'URL' : //this.url

With a Metric (aka Events), like all other metrics, you can do aggregated segments across a time series “Visited from UTM 2 or more times in the last 30 days” or “Visited from UTM where UTM_Campaign = X” so this might be more useful to build more complex segments.

However, there *is* one place where you get a lot of data from Facebook, and that’s through Facebook Lead Ads integration with Klaviyo. 

When a Facebook Lead Ad generates a “Lead” - it passes that into Klaviyo via a Metric called “Filled Out Lead Ad” with a bunch of event properties.  

Here’s a sample (sensitive values blurred out)

Facebook Lead Ad Event Properties

: ​

So as you can see, you get a bunch of properties that you can either build segments from, or use in a branching logic in a Flow.  Just note, this only happens with a “Facebook Lead Ad” type of ads on Facebook/IG.