This article describes how to set up the Facebook Pixel tag in your Tealium iQ Tag Management account.

For information about the legacy Facebook Pixel, see Facebook Pixel Setup Guide (Legacy).

In this article:

Table of Contents Placeholder

How it Works

Tag Overview

  • Purchase tracking occurs automatically when an order ID is populated.
  • You may enter a comma-separated list of Pixel IDs in the Pixel ID field.
  • To make Facebook Pixel Event IDs available as server-side attributes, set Generate Event ID to true and use the latest version of the Tealium Collect tag.
  • The template automatically attempts to calculate the num_items value if a product quantity array is present.
  • Use mapping to:
    • Toggle trackSingle (true by default)
    • Toggle disablePushState (false by default)
    • Dynamically set the tag configurations
    • Override the E-Commerce extension values
  • Supports these E-Commerce extension parameters:
    • Order ID
    • Sub Total
    • Currency
    • List of Product IDs
    • List of Product Categories
    • List of Product Prices
    • List of Product Quantities
    • List of Product Names

Conversions API for Web

To support the Facebook Conversions API for Web, the tag generates a unique event ID for each event tracked and send it to Tealium EventStream for use in the Facebook Conversions connector. The event ID may be mapped in the connector to synchronize the web-based on server-based integrations. This feature requires an active Tealium Collect tag.

The tag emits new event attributes using the following naming convention:

fb_event_id_<Facebook Event>

For example: fb_event_id_Purchase or fb_event_id_PageView

See the Facebook Conversions Connector Setup Guide.

Tag Configuration

First, go to the Tealium Tag Marketplace and add the Facebook Pixel tag (Learn more about how to add a tag).

After adding the tag, configure the following settings:

  • Pixel ID
    • Your Facebook Pixel ID.
    • The Pixel ID appears as a long series of numbers in the code snippet.
    • You may enter multiple Pixel IDs using a comma-separated list, without spaces.
    • Example: fbq("init", "12345678901234");
  • Advanced Matching
    • Enable and pass data to the Facebook Advanced Matching service.
    • Example: fbq("init", "12345678901234", {em:"6dd8b7d7..."});
  • Generate Event ID
    • Automatically generate an event ID for every Facebook tracking event.
    • Event ID attributes follow the naming convention: fb_event_id_<Facebook Event>
    • Example: fb_event_id_Purchase : "028b2ade7478..."

Event Mapping

Facebook Pixel events are configured through data mappings by selecting a variable that maps to an event and entering a trigger.  The trigger initiates the event when the variable is equal to a specific value, as demonstrated in the following use case.

Use Case: Purchase Event

To set up a purchase event:

  1. Select  tealium_eventfrom the variable dropdown and click Select a Destination.
  2. In the Category section, select Events.
  3. Set the When mapped variable equals field to Purchase, which is the value tealium_event must equal to trigger a purchase.
  4. In the Trigger event dropdown, select Purchase , which is the event that is triggered when tealium_event equals purchase.

a.png

If additional data needs to be sent with the purchase event that is not already covered by the built-in E-Commerce extension mappings, use Custom Parameters to map additional purchase data.

The following example passes the product brand with the purchase event:

  1. Select  product_brand  from the variable dropdown and click Select a Destination.
  2. In the Category section, select Event specific Parameters.
  3. Set the Destination field to  the name brand for the Custom Parameter.
  4. In the For event dropdown, select the event Purchase which the Custom Parameter collects with.

c.png

Test the mappings by using the Facebook Pixel Helper or your browser’s Developer Tools.  

  1. Use the Network Panel and filtering for Facebook to display all the network requests containing Facebook as a keyword.
  2. Confirm the purchase event was successful by looking at the name of the request.
  3. Open the request and scroll down to the Query String Parameters to see the values of the the data mappings that were configured: purchase , product_id , and product_brand .

d.png

Data Mappings

Data mappings follow a hierarchy in which specific mappings, such as Event-Specific Parameters, take precedence over more general mappings. For example, if you map a variable to the Currency destination in the Standard Tracking Parameters tab and to the Currency destination for the ViewContent event, the ViewContent mapping takes precedence over the general mapping, but only for the ViewContent event. For all other events, the Standard Tracking mapping is used.

Mapping is the process of sending data from a data layer variable to the corresponding destination variable of the vendor tag. For instructions on how to map a variable to a tag destination, see Data Mappings.

The available categories are:

Tag Configurations

Destination Variable Type Description
Pixel ID pixel_id [String]
  • Your Facebook Pixel ID.
  • The Pixel ID appears as a long series of numbers in the code snippet.
  • You may enter multiple Pixel IDs using a comma-separated list, without spaces.
  • Example: fbq("init", "12345678901234");
Toggle Automatic PageView auto_page_view

Boolean

[true/false]

  • Toggle to enable or disable automatic PageView tracking.
  • Toggles whether or not to automatically trigger a PageView event with a page load.
  • Default value is true.
Toggle Advanced Matching advanced_matching

Boolean

[true/false]

  • Toggle to enable or disable the collection of Advanced Matching data.
  • Toggles whether or not to capture and send advanced matching data.
  • Default value is true.
Generate Event IDs generate_event_id

Boolean

[true/false]

  • Toggle to enable or disable the generation of Event IDs for each Facebook tracking event.
  • Toggles whether or not a unique Event ID is generated for each Facebook tracking event.
  • Requires the most recent version of the utag.js file in order to generate the IDs.
  • Default value is false.
Automatically Calculate Number of Items calc_items

Boolean

[true/false]

  • Toggle to control whether or not to automatically determine the number of items for an event.
  • Uses the data mapped to Product Quantities to determine the number.
  • Toggles whether or not to automatically calculate the number of items in a Facebook tracking event based on the number of items in the product_quantity array.
  • Default value is true.
Toggle trackSingle Usage track_single

Boolean

[true/false]

  • Enable or disable the use oftrackSingle for Facebook tracking events.
  • Toggles whether or not to use trackSingle for Facebook Pixel tracking calls.
  • Default value is true.
  • If set to false, the value track is used for all Facebook tracking calls.
Toggle disablePushState Usage disablePushState

Boolean

[true/false]

  • Toggles the disablePushState setting.
  • Toggle to enable or disable the disablePushState option which controls whether or not to prevent the triggering of multiple PageViews on the same page (for Single Page Apps).
  • Default value is false.

E-Commerce

Since the Facebook Pixel tag is e-commerce enabled, it automatically uses the default E-Commerce Extension mappings. Manually mapping in this category is not needed unless you want to override any extension mappings or your desired e-commerce variable is not offered in the extension.

Destination Variable Description E-Commerce Extension Variable
Order ID order_id
  • Unique identifier assigned to the final order.
  • Overrides _corder.
_corder
Sub Total sub_total
  • Sub total amount of the final order.
  • Overrides _csubtotal.
_csubtotal
Currency order_currency
  • Currency used in the payment.
  • Overrides _ccurrency.
_ccurrency
List of Product IDs product_id
  • Unique identifier of each product in the product array.
  • Overrides _cprod.
_cprod
List of Product Names product_name
  • Name of each product in the product array.
  • Overrides _cprodname.
_cprodname
List of Product Quantities product_quantity
  • Quantity of products in the product array.
  • Overrides _cquan.
_cquan
List of Categories product_category
  • Category of each product in the product array.
  • Overrides _ccat.
_ccat
List of Prices product_unit_price
  • Unit price of each product in the product array.
  • Overrides _cprice.
_cprice

Standard Tracking Parameters

Destination Variable Type Description
Currency currency [String]
  • The currency for the value of the event.
Content Category content_category [Array,String]
  • Category of the page/product.
Content Name content_name [Array,String]
  • Name of the page/product
Content IDs content_ids [Array]
  • The product IDs or SKUs associated with the event
Content Type content_type [String]
  • The product type associated with the content IDs, which matches the types given in your Facebook product feed.
  • In most cases this is either product or product_group.
  • Dynamic Ads have other legitimate values for each business vertical.
Contents contents [Array,JSON Object]
  • An array of JSON objects that contains the quantity and the content IDs.
Predicted Lifetime Value predicted_ltv [String]
  • Predicted lifetime value of a subscriber as defined by the advertiser.
  • Expressed as an exact value
Search String search_string [String]
  • Used with the Search event.
  • The string entered by the visitor for the search.
Status status [String]
  • Used with the completeRegistration event.
  • The status of the registration.
Number of Items num_items [Number]
  • The number of items for the event.
  • The number of items is automatically calculated based on the values in the data mapped for quantity.
  • Disable the automatic calculation by setting calc_items (u.data.calc_items ) to false, using data mapping or an extension.
Value value [String]
  • The value of a user performing this event to the business.

Content Type

Set the content_type parameter by mapping to it directly in either the Standard Tracking Parameters tab, or the Event-specific Parameter mappings.

The Content Type tab allows you to conditionally set the content_type parameter to any of the following supported values:

  • destination
  • flight
  • home_listing
  • hotel
  • product
  • product_group
  • vehicle

If the mapped variable equals the value you enter in the field, then the value is set to the type you select from the drop-down list. In most cases, the values product or product_group are used, and that value must match the content_type you specify for the products in your product feed uploaded to Facebook. Other values are most commonly used with Dynamic Ads.

Variable Description
destination
  • Destination.
flight
  • Flight.
home_listing
  • Home Listing.
hotel
  • Hotel.
product
  • Product.
product_group
  • Product Group.
vehicle
  • Vehicle.

Events

Event Name Description
AddPaymentInfo
  • Add payment information.
AddToCart
  • Add to cart.
AddToWishlist
  • Add to wish list.
CompleteRegistration
  • Complete registration.
Contact
  • Contact.
CustomizeProduct
  • Customize product.
Donate
  • Donate.
FindLocation
  • Find location.
InitiateCheckout
  • Initiate checkout.
Lead
  • Lead.
PageView
  • Page view.
Purchase
  • Purchase.
Schedule
  • Schedule.
Search
  • Search.
StartTrial
  • Start trial.
SubmitApplication
  • Submit application.
Subscribe
  • Subscribe.
ViewContent
  • View content.
Custom
  • Enter the name of your custom event in the field provided.

Event-specific Parameters

In order to map a parameter for a specific event only, first select the name of the parameter from the drop-down list,

Enter the name of the parameter you want to set and then select the name of the event for which you want to set that parameter.

  • If you are mapping a parameter for a custom event, you must enter the name of the custom event in the field that appears.
  • If you want to enter a custom parameter name, select the Custom option from the parameter drop-down list and enter the name of the custom parameter in the field that displays.
  • If you want to specify a custom event for the event-specific mapping to occur, select the Custom option from the events drop-down list and enter the name of the custom event in the field that displays.
Variable Description
AddPaymentInfo
  • Add payment information.
AddToCart
  • Add to cart.
AddToWishlist
  • Add to wish list.
CompleteRegistration
  • Complete registration.
Contact
  • Contact.
CustomizeProduct
  • Customize product.
Donate
  • Donate.
FindLocation
  • Find location.
InitiateCheckout
  • Initiate checkout.
Lead
  • Lead.
PageView
  • Page view.
Purchase
  • Purchase.
Schedule
  • Schedule.
Search
  • Search.
StartTrial
  • Start trial.
SubmitApplication
  • Submit application.
Subscribe
  • Subscribe.
ViewContent
  • View content.
Custom
  • Custom.

Automotive Parameters

Destination Variable Description
Body Style body_style
  • Body style.
Condition of Vehicle condition_of_vehicle
  • Condition of vehicle.
Country country
  • Country.
Drivetrain drivetrain
  • Drive train.
Exterior Color exterior_color
  • Exterior color.
Fuel Type fuel_type
  • Fuel type.
Interior Color interior_color
  • Interior color.
Lead Type lead_type
  • Lead type.
Make make
  • Make.
Model model
  • Model.
Postal Code postal_code
  • Postal code.
Preferred Price Range preferred_price_range
  • Array.
  • Preferred price range.
  • Must be an array that contains the minimum and maximum preferred prices.
Price price
  • Price.
Registration Type registration_type
  • Registration type.
Search Type search_type
  • Search type.
State of Vehicle state_of_vehicle
  • State of vehicle.
Transmission transmission
  • Transmission.
Trim trim
  • Trim.
ViewContent Type viewcontent_type
  • View content type.
VIN vin
  • VIN number
Year year
  • Year.

Destination Parameters

Variable Description
city
  • City.
country
  • Country.
num_adults
  • Number of adults.
num_children
  • Number of children.
region
  • Region.

suggested_destinations

  • Array.
  • Suggested destinations.
  • Must be an array of the suggested destinations.
travel_start
  • Travel start date.
travel_end
  • Travel end date.

Flight Parameters

Variable >Description
departing_arrival_date
  • Departing arrival date.
departing_departure_date
  • Departing departure date.
destination_ids
  • Destination IDs.
num_adults
  • Number of adults.
num_children
  • Number of children.
num_infants
  • Number of infants.
preferred_num_stops
  • Preferred number of stops.
price
  • Price.
returning_arrival_date
  • Returning arrival date.
returning_departure_date
  • Returning departure date.
travel_class
  • Travel class.
user_score
  • User score.

Hotel Parameters

Variable Description
checkin_date
  • Check-in date.
checkout_date
  • Check-out date.
city
  • City.
country
  • Country.

destination_ids

  • Array.
  • Destination IDs.
  • Must be an array that contains Destination IDs.
hotel_score
  • Hotel score.
num_adults
  • Number of adults.
num_children
  • Number of children.
preferred_neighborhoods
  • Array.
  • Preferred neighborhoods.
preferred_price_range
  • Array.
  • Preferred price range.
preferred_star_ratings
  • Preferred star ratings.
region
  • Region.
user_score
  • User score.

Movie Parameters

Variable Description
movieref
  • Movie referrer.

Real Estate Parameters

Variable Description
availability
  • Availability.
city
  • City.
country
  • Country.
lease_start_date
  • Lease start date.
lease_end_date
  • Lease end date.
listing_type
  • Listing type.
neighborhood
  • Neighborhood.
preferred_baths_range
  • Array.
  • Preferred baths range.
preferred_beds_range
  • Array.
  • Preferred beds range.
preferred_price_range
  • Array.
  • Preferred price range.
property_type
  • Property type.
region
  • Region.

Cookie Consent

Variable Description
 grant grant cookie consent
 revoke revoke cookie consent

Limited Data Use

Variable Description

 

lmt_data.use_ldu (Use LDU)

  • If true , use Facebook’s Limited Data Use option

  • If false , do not use Facebook’s Limited Data Use option

lmt_data.ldu_types.geolocate (LDU should Geolocate)

  • If true , the LDU geolocates the user.
  • If false , the LDU doe snot geolocate the user. If “Use LDU” is enabled, then “LDU should Geolocate” is also enabled by default.

lmt_data.ldu_types.california (LDU is California)

  • If true , sets the state and country California-specific values inside the template. Only enable this option if the user is located in California and needs to be processed with Limited Data Use.
  • If false , does not set the user’s state and country California-specific values inside the template.

Vendor Documentation

See the following vendor documentation for more information: