Facebook Pixel Tag Setup Guide
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).
How it works
-
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
- Toggle
-
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
The Pixel tag automatically hashes user data.
Conversions API for Web
To support the Facebook Conversions API for Web, the tag generates a unique event ID for each event tracked and sends 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}_{TAG_UID}
For example: fb_event_id_Purchase_32 : "028b2ade7478..."
or fb_event_id_PageView_32
IDs were previously generated as fb_event_id_{FACEBOOK_EVENT}
. These IDs will continue to be generated, but are considered legacy. The new IDs allow for use with multiple Facebook tags firing on a single page and offer a stronger tie back to the related tag. If you are using the legacy version, you must change the connector to the new ID.
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..."});
- If you enable Advanced Matching and then map parameters with Personally-Identifiable Information (PII), we strongly recommend that you disable Automatic Advanced Matching in the Meta Events Manager and only map parameters manually. Automatic Advanced Matching may map additional PII parameters that are outside of your needs and scope, causing a security and privacy issue. For more information, see Set up automatic advanced matching for your website or mobile app at Facebook.
- 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:
- Select
tealium_event
from the variable drop-down list and click Select a Destination. - In the Category section, select Events.
- Set the When mapped variable equals field to
Purchase
, which is the valuetealium_event
must equal to trigger a purchase. - In the Trigger event drop-down list, select
Purchase
, which is the event that is triggered whentealium_event
equals purchase.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:
- Select
product_brand
from the variable drop-down list and click Select a Destination. - In the Category section, select Event specific Parameters.
- Set the Destination field to the name
brand
for the Custom Parameter. - In the For event drop-down list, select the event
Purchase
which the Custom Parameter collects with.
Test the mappings by using the Facebook Pixel Helper or the Developer Tools offered by your browser.
- Use the Network Panel and filtering for Facebook to display all the network requests containing Facebook as a keyword.
- Confirm the purchase event was successful by looking at the name of the request.
- 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
, andproduct_brand
.
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] |
|
Toggle Automatic PageView | auto_page_view |
Boolean [true /false ] |
|
Toggle Advanced Matching | advanced_matching |
Boolean [true /false ] |
|
Generate Event IDs | generate_event_id |
Boolean [true /false ] |
|
Automatically Calculate Number of Items | calc_items |
Boolean [true /false ] |
|
Toggle trackSingle Usage | track_single |
Boolean [true /false ] |
|
Toggle disablePushState Usage | disablePushState |
Boolean [true /false ] |
|
Advanced Matching
Destination | Variable | Type | Description |
---|---|---|---|
am.em |
[String] |
|
|
First Name | am.fn |
[String] |
|
Last Name | am.ln |
[String] |
|
Phone Number | am.ph |
[String] |
|
Gender | am.ge |
[String] |
|
Date of Birth | am.db |
[String] |
|
City | am.ct |
[String] |
|
State | am.st |
[String] |
|
Zip | am.zp |
[String] |
|
External ID | am.external_id |
[String] |
|
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 |
|
_corder |
Sub Total | sub_total |
|
_csubtotal |
Currency | order_currency |
|
_ccurrency |
List of Product IDs | product_id |
|
_cprod |
List of Product Names | product_name |
|
_cprodname |
List of Product Quantities | product_quantity |
|
_cquan |
List of Categories | product_category |
|
_ccat |
List of Prices | product_unit_price |
|
_cprice |
Standard Tracking Parameters
Destination | Variable | Type | Description |
---|---|---|---|
Currency | currency |
[String] |
|
Content Category | content_category |
[Array,String] |
|
Content Name | content_name |
[Array,String] |
|
Content IDs | content_ids |
[Array] |
|
Content Type | content_type |
[String] |
|
Contents | contents |
[Array,JSON Object] |
|
Predicted Lifetime Value | predicted_ltv |
[String] |
|
Search String | search_string |
[String] |
|
Status | status |
[String] |
|
Number of Items | num_items |
[Number] |
|
Value | value |
[String] |
|
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 |
|
flight |
|
home_listing |
|
hotel |
|
product |
|
product_group |
|
vehicle |
|
Events
Event Name | Description |
---|---|
AddPaymentInfo |
|
AddToCart |
|
AddToWishlist |
|
CompleteRegistration |
|
Contact |
|
CustomizeProduct |
|
Donate |
|
FindLocation |
|
InitiateCheckout |
|
Lead |
|
PageView |
|
Purchase |
|
Schedule |
|
Search |
|
StartTrial |
|
SubmitApplication |
|
Subscribe |
|
ViewContent |
|
Custom |
|
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 |
|
AddToCart |
|
AddToWishlist |
|
CompleteRegistration |
|
Contact |
|
CustomizeProduct |
|
Donate |
|
FindLocation |
|
InitiateCheckout |
|
Lead |
|
PageView |
|
Purchase |
|
Schedule |
|
Search |
|
StartTrial |
|
SubmitApplication |
|
Subscribe |
|
ViewContent |
|
Custom |
|
Automotive Parameters
Destination | Variable | Description |
---|---|---|
Body Style | body_style |
|
Condition of Vehicle | condition_of_vehicle |
|
Country | country |
|
Drivetrain | drivetrain |
|
Exterior Color | exterior_color |
|
Fuel Type | fuel_type |
|
Interior Color | interior_color |
|
Lead Type | lead_type |
|
Make | make |
|
Model | model |
|
Postal Code | postal_code |
|
Preferred Price Range | preferred_price_range |
|
Price | price |
|
Registration Type | registration_type |
|
Search Type | search_type |
|
State of Vehicle | state_of_vehicle |
|
Transmission | transmission |
|
Trim | trim |
|
ViewContent Type | viewcontent_type |
|
VIN | vin |
|
Year | year |
|
Destination Parameters
Variable | Description |
---|---|
city |
|
country |
|
num_adults |
|
num_children |
|
region |
|
suggested_destinations |
|
travel_start |
|
travel_end |
|
Flight Parameters
Variable | >Description |
---|---|
departing_arrival_date |
|
departing_departure_date |
|
destination_ids |
|
num_adults |
|
num_children |
|
num_infants |
|
preferred_num_stops |
|
price |
|
returning_arrival_date |
|
returning_departure_date |
|
travel_class |
|
user_score |
|
Hotel Parameters
Variable | Description |
---|---|
checkin_date |
|
checkout_date |
|
city |
|
country |
|
destination_ids |
|
hotel_score |
|
num_adults |
|
num_children |
|
preferred_neighborhoods |
|
preferred_price_range |
|
preferred_star_ratings |
|
region |
|
user_score |
|
Movie Parameters
Variable | Description |
---|---|
movieref |
|
Real Estate Parameters
Variable | Description |
---|---|
availability |
|
city |
|
country |
|
lease_start_date |
|
lease_end_date |
|
listing_type |
|
neighborhood |
|
preferred_baths_range |
|
preferred_beds_range |
|
preferred_price_range |
|
property_type |
|
region |
|
Cookie Consent
Variable | Description |
---|---|
grant |
grant cookie consent |
revoke |
revoke cookie consent |
Limited Data Use
Variable | Description |
---|---|
lmt_data.use_ldu (Use LDU) |
|
lmt_data.ldu_types.geolocate (LDU should Geolocate) |
|
lmt_data.ldu_types.california (LDU is California) |
|
Vendor Documentation
See the following vendor documentation for more information:
This page was last updated: April 21, 2022