Planning Website Custom Audiences (Deprecated)

Custom Audiences from your Website allows you to target your Facebook ads to audiences of people who have visited your website and remarket to people who have expressed interest in your products.

In this guide you will learn how to:

Marketing Objectives

Below we identify several broad categories of marketing objectives for website Custom Audiences:

Remarketing To Potential Customers

When people visit your website and take an action, such as browse a product category, search for a particular item, or place an item in a cart, they are expressing an explicit interest in your products. You can use website Custom Audiences to capture this intent and later target those people on Facebook with relevant ads that help them take the next steps to complete a transaction on your website.

In order to accomplish this effectively, we recommend using Dynamic Product Ads which can automatically show ads with the products that a user most recently viewed or added to cart. By featuring highly relevant creatives, these ads typically perform very well especially for e-commerce websites.

Excluding Existing Customers

In many cases you'll want to exclude certain audiences from your ad campaigns to make the campaigns more efficient and avoid showing irrelevant ads to people.

One common example is when you are running campaigns to acquire new customers and want to exclude people who have already bought from your website. Another example may be when someone has already purchased one product and you want to stop showing them ads about that product or category but continue to show them ads for complementary products.

Finding New Potential Customers

Facebook's lookalike models let you target people who are similar to Custom Audiences from your website. For example, you can create a website Custom Audience of people who buy high value items on your website. You can then use this website Custom Audience as a seed for a lookalike audience to find similar people on Facebook and target them with ads designed to acquire new customers.

Website Structure

The quality and versatility of your website Custom Audiences depend on where you place the Custom Audience pixel on your website, how you place it, and what data you make available to the pixel. Once you've determined your marketing objectives and the types of audience segments you will want to create, the next thing to think about is where on your website to place the Custom Audiences pixel.

Where To Place The Pixel

We recommend you place the Custom Audience pixel across all pages of your website. This will enable you to capture the Audiences across your entire marketing funnel and avoid having to keep installing or moving around the pixel as your marketing objectives change over time.

In the cases where it may not be practical to place the pixel on all pages you will need to prioritize the pages where to add the pixel. Here are some actions commonly used in audience segmentation and the page on your website where you would place the pixel. These are general recommendations but every website is unique so you should understand these recommendations then map them to your website's structure.

Audience SegmentWhere To Place Custom Audiences Pixel

All potential customers

All pages on your website possibly using a common header file.

People who searched for a product on your website

Search results page.

People who viewed a specific product or category.

Product details page.

People who started purchasing.

Add To Cart or Checkout page.

People who completed purchasing.

Order confirmation page.

People who were referred from a paid search engine result.

Landing pages for your search ads.

People interested in clearance/deals.

Clearance/deals page.

What Data To Pass To The Pixel

For Dynamic Product Ads you need to pass three specific events: ViewContent, AddToCart and Purchase. You can find more information about these events and examples in the Dynamic Product Ads pixel implementation document

If you are not using Dynamic Product Ads, you need to modify the Custom Audience pixel only if your marketing needs require more data than the URL can provide to match your desired audience segment.

For example, say you want to create an audience of anyone who makes a search for the words "cargo lines". The search results page on your website may have the following URL:

Here the Custom Audiences pixel that you placed on the search results page will automatically capture this URL. You can later create an audience segment where the URL contains "cargo liner" and target that audience with ads about cargo liners. As long as your website captures the search term somewhere in the URL you can do the same.

Similarly, if a person browses a certain product category on your website they may land on a page whose URL looks like this:

Again, the Custom Audiences pixel on the category page will automatically capture the above URL including the catId parameter. You can then create an audience segment where the URL contains cat18501 and target that audience with ads about that category.

Here are the commonly used actions along with some parameters:

Audience SegmentData Typically Used For Segmentation (from page URL)

All potential customers

Your page URL

People who searched for a product on your website

Search terms and other search parameters e.g. dates, colors, sizes, styles, country, destination id

People who viewed a specific product or category.

Product id, product category, product variations e.g. dates, color, size, style, country, destination id. See ViewContent event.

People who started purchasing.

Cart value, products in cart (product id, product category, product variations e.g. dates, color, size, style, country, destination id.) See AddToCart event.

People who completed purchasing.

Order value, products purchased (product id, product category, product variations e.g. dates, color, size, style, country, destination id. See Purchase event.

People who were referred from a paid search engine result.

Search string, search campaign, search source.

People interested in clearance/deals.

Product id, product category, sale expiration date, product variations e.g. dates, color, size, style, country, destination id.

With the upgraded Custom Audience pixel we have added 9 predefined standard events that you can place across websites such as the ones used in Dynamic Product Ads: ViewContent, AddToCart, Purchase and many more. When you place these standard events on your website, they are also eligible conversion reporting and optimization. Learn more about these standard events and the suggested parameters here

Sending custom data

In some cases you may want to segment your audiences using data that is not available in the page URL. To do so you will need to make changes to the Custom Audiences pixel code.

If the data you want to segment by is known on the server side when the page is being sent to the browser, you can use server-side code to explicitly set the event name and parameters on the Custom Audiences pixel as it is being added to the page.

For example adding a custom destination parameter to the pixel fire:

<script>(function() {
  var _fbq = window._fbq || (window._fbq = []);
  if (!_fbq.loaded) {
    var fbds = document.createElement('script');
    fbds.async = true;
    fbds.src = '//';
    var s = document.getElementsByTagName('script')[0];
    s.parentNode.insertBefore(fbds, s);
    _fbq.loaded = true;
  _fbq.push(['addPixelId', "1234567890"]);
window._fbq = window._fbq || [];
// this line of JS code can be added by 
// server-side code that has the data needed to segment your audience
window._fbq.push(["track", "StartBooking", {destination: "nyc"}]);
<!-- this <img> tag can also be added by server-side code -->
<!-- this is needed in case the browser doesn't support JS -->
<img height="1" width="1" border="0" alt="" style="display:none" 
src="[destination]=nyc" />

If however the data is only known on the client side, you can write some JS code to dynamically trigger Custom Audiences pixel events by using the Facebook Tag API.

With the upgraded Custom Audience you can send a bunch of supported parameters and custom parameters with the standard events



fbq('init', '<FB_PIXEL_ID>');
fbq('track', 'ViewContent', { 
    content_type: 'product',
    content_ids: ['1234'],
    content_name: 'ABC Leather Sandal',
    content_category: 'Shoes',
    value: 0.50,
    currency: 'USD'

How To Place The Pixel

The Custom Audiences pixel is a small snippet of JS (JavaScript) code that runs whenever someone opens a page with it installed. The code is loaded asynchronously so that it is very fast and doesn't get in the way of people loading your website.

For best results we recommend placing the pixel directly into the HTML of the page, immediately before the </head> tag. Placing the code directly in the page, rather than a tag manager or in an iframe reduces the chances of the browser or third party code blocking the JS from executing. Placing the code within the <head> section of HTML allows the code to execute sooner, and increases the chances of the person navigating the page to be captured in an audience before they close the page.

On using the IMG tag

The Custom Audience pixel can also be used as an <img> tag. We discourage advertisers from using only the image tag because some functionality may be lost. However, there may be some use cases where a light weight implementation is required. In this case you may use the <img> tag between the <noscript> portion of the JS tag to collect a website Custom Audience.

For example,

<img src="<FB_PIXEL_ID>&ev=PageView&noscript=1" height="1" width="1" style="display:none"/>

Sending parameters using img pixel:

<img src="<FB_PIXEL_ID>&ev=ViewContent&cd[content_name]=ABC%20Leather%20Sandal&cd[content_category]=Shoes&cd[content_type]=product&cd[content_ids]=1234&cd[value]=0.50&cd[currency]=USD&noscript=1" height="1" width="1" style="display:none"/>

Please note that the following features are supported by the JS version of the pixel and not by the IMG version of the pixel:

  • JS pixel can be fired multiple times on each page load.
  • JS pixel can be used to control when an event should be fired (i.e., upon a button click).
  • JS pixel is not subject to HTTP GET limit in sending custom data or long URLs.
  • JS pixel is being loaded asynchronously VS. the image pixel which is being loaded as an image, synchronously.

On Tag Managers

In some cases advertisers choose to use a tag manager to make it easier to manage multiple marketing pixels and other JS code. Although we recommend adding the the Custom Audience pixel directly into the HTML it is possible to "piggyback" the pixel on another tag. The Custom Audience pixel should work in most tag management and tag container solutions. For specific advice on implementing website Custom Audiences with your tag manager please consult your tag manager's documentation.

Mobile Websites

Everything we discussed thus far applies to mobile websites as well as desktop websites. If your mobile website is separate from your desktop website you should consider adding the Custom Audiences pixel to it as well. Adding the pixel to your mobile website allows you to segment people who visit your mobile website, remarket to those audience segments, exclude or create lookalikes.

Audience Source vs. Ad Placement

The audience segments you create can have people who visited your desktop website or mobile website or both. You can then remarket to those audiences with ads placed on Facebook's desktop website, Facebook's mobile website and/or Facebook's iOS and Android apps. The placement of those ads is completely independent of the source of the audience. In fact it's pretty common to capture people who visit your mobile website and retarget them with ads on Facebook's desktop website to get them to convert via your desktop website (conversion rates tend to be higher for desktop compared to mobile websites). Similarly, you can target people who visit your desktop website and show them ads in Facebook's mobile app to get them to install your mobile app. So don't confuse where people visit your website with where you place an ad to remarket to them.

What Next

Planning Worksheet

To help you plan and collect the information necessary for a successful implementation, we created a worksheet to act as a guide for your planning process. Please download the Planning worksheet and fill it in as you proceed with planning.

Related Docs