How to Target Referral Traffic with Facebook Ads

Facebook advertisers have a deep toolbox available to help reach their ideal audience. One underutilized and underappreciated group they can target is their referral traffic.

How much of your traffic comes from Google? From Instagram? From somewhere else? Are the behaviors, needs, and expectations of these people different from your typical visitor?

Knowing the referral source could allow you to create advertising that caters specifically to their needs.

I have admittedly long taken for granted that not everyone has the ability to create referral Custom Audiences. I’ve been able to do this for years. It’s not because I have access to any Facebook features that others do not. It’s simply due to how my pixel is set up.

My pixel collects parameters along with the standard PageView event. These parameters allow Facebook to collect things like referrer, language, post category, post tags, and more related to the visit.

I have a third party tool that does this for me. While I’ll provide details on that, you don’t necessarily need to use a third party tool to accomplish this. I’ll also provide the manual solution for everyone else to create the custom parameters that will help you generate referral Custom Audiences.

Custom Parameters: Test

You may already be adding parameters to your pixel for certain events, like purchases. In that case, you may include details like product ID and price. But we can do the same for the base PageView event.

In order to create Custom Audiences based on referral source (and other information mentioned above), we need to collect parameters for all visits with our pixel. In a moment, I’ll get to how you set this up. But first, let’s test to see if you have this set up already.

If you use a plugin that injects your pixel code, you may have a setting like I do to control whether your visits as an administrator get tracked.

For this test, you may either want to turn this off or simply log out first. Then, do the following…

1. Install the Facebook Pixel Helper Chrome plugin (it’s free).

2. Go to Google.

3. Type in a search that would bring up results to a blog post or page on your website. Be as specific as possible to make sure you get the results you want.

4. Click the link in the Google Search results that redirect you to that page on your website. You will now be referral traffic from Google.

5. While on that page of your website, click the Pixel Helper icon.

Here’s what my results look like:

Facebook Pixel Helper

I have a section for AdvancedEvents. That’s where my parameter info is. I click to expand and the following details are revealed…

Facebook Pixel Helper

As you can see, the following parameters were collected:

  1. Login Status
  2. Post Tag
  3. Post Category
  4. Language
  5. Post Type
  6. Object Type
  7. User Agent
  8. Object ID
  9. Referrer

Note that there may be others that my pixel collects, but these are the items that were relevant in this case. If I went directly to my home page without a referral from Google (or somewhere else), I wouldn’t see parameters for Post Tag, Post Category, or Referral.

Keep in mind that you may still have Custom Parameters, but organized differently. My plugin organizes them under AdvancedEvents, but it may appear differently for you.

Add Custom Parameters: Pixel Caffeine

The reason I’ve long added these parameters is that I use the free Pixel Caffeine WordPress plugin (not an affiliate link).

[SIDE NOTE: I don’t use affiliate links. I get nothing from Pixel Caffeine for referring them.]

Within my Pixel Caffeine general settings, I have all of the Advanced Tracking checked…

Pixel Caffeine

Add Parameters to PageView Event: Manually

Of course, I realize not everyone uses Pixel Caffeine. In fact, it occurred to me during research for this post that most websites don’t collect parameters on every page view. As a test, I went to several websites (including as a Google referral), and I couldn’t find a single one that tracked this information.

I reached out to an engineer at Pixel Caffeine to find out how someone would do this manually. They were very kind to provide the info.

When you go through the manual pixel setup process, Facebook provides the base pixel code that you need to paste before the closing HEAD tag in the template of your website.

Facebook Pixel Setup

If you paste this base pixel code manually into your template or into either a plugin or Google Tag Manager, you should be able to do this.

We need to inject some additional code after ‘PageView’ and before the closing SCRIPT.

fbq('track', 'PageView', {
referrer: document.referrer
});

As a result, Facebook should then track the referrer for every page view of your website.

Note that I haven’t tested this myself, but I’ve been assured it will work. Please report back.

Create Website Custom Audience

Once you start collecting this information, you should be able to create Website Custom Audiences for these relevant groups. Note that it may take a day or two to show up.

When creating a Website Custom Audience, you should see an option for “From Your Events.” Under it, select the “PageView” event.

Facebook Website Custom Audience

Next, click “Refine by” and then “URL/Parameter.”

Facebook Website Custom Audience

Click the drop-down where “URL” appears. You will now see relevant parameter options that you are tracking. Select “referrer.”

Facebook Website Custom Audience

If you want to create an audience of all referral traffic from Google, I’d select “Contains” and enter in “google.com” below it.

Facebook Website Custom Audience

I’d avoid containing traffic that only includes “google” as it’s possible that this will pull in traffic that includes Google in a URL or UTM parameter. In those cases, it’s not guaranteed to always be referral traffic from Google.

After doing this, of course, it occurred to me that the domain is different depending on the country. You may also want to include other variations of the Google domain, like google.co.uk. Or, include far more variations at once by using google.co.

You may not want to create Custom Audiences of referral traffic from Google. Maybe it’s from Pinterest. It’s the same process. Simply create your audience based on the Pinterest domain instead.

The duration you use for this Website Custom Audience is up to you. Keep in mind the volume of referral traffic that you get when setting this.

Alternate Method: Facebook Analytics

Thanks to Yan Yanko for alerting me of an alternative. If you are using Facebook Analytics, you can also create a filter for referral traffic. In fact, you should be able to create a filter for many of the things that would otherwise be covered with parameters. You could then create a Custom Audience from that.

At the top of Facebook Analytics, click the “Add Filter” button…

Facebook Analytics

Then click “Create new filter” > “had matching web parameters” > “Referral Domain” > “contains” > “google.”

Facebook Analytics

Then, at the top right click the “…” and select “Save Filter.”

Facebook Analytics

After saving the filter, go back to the same menu at the top right and select “Create Custom Audience.”

Facebook Analytics

I assumed that this would only work if you had the necessary parameters set up with your pixel, but Yan assures me it’s a workaround that works.

Other web parameters I see when creating filters in Facebook Analytics:

  • Current Domain
  • Current URL
  • Referral Domain
  • Referral URL
  • Session Exit URL
  • Session Landing URL
  • Session Referrer Domain
  • Session Referrer URL
  • Session Traffic Source
  • Session Traffic Source by Search Engine
  • Session Traffic Source by Social Network

There are also several UTM-related filters. I had assumed these would only appear and work if you were using these parameters. That doesn’t appear to be the case.

Try it and report back!

Target Referral Traffic

Now that you’ve created the Website Custom Audience of referral traffic, you can target these people!

Within the ad set, enter the name of the audience you just created…

Facebook Website Custom Audience Targeting

You may want to use the Worldwide region, but it’s up to you at this point. Only you know what kind of volume you get from these referrals.

Is there something specific that people search for when they come to your website as a result of a referral? If so, can you then serve them an ad related to this need?

Your Turn

I hope this guide helps you set up the ability to target referral traffic with Facebook ads. Have you done this before? What results do you see?

Let me know in the comments below!