Facebook Pixel & Event Tracking
What is Facebook Pixel ?
Why Need Facebook Pixel?
● Capturing site visitor data
● Build retargeting lists
● Track standard & custom events & conversions
● Build lookalike audiences (audience expansions)
● Provide people based reporting through Facebook Analytics
- Standard Event vs Custom Event
- Custom Audience vs Custom Conversion
Standard Events
● PageView
● AddPaymentInfo
● AddToCart
● AddToWishlist
● CompleteRegistration, etc.
Custom Events
● Scroll
● Time on page (e.g. when you fire an event after a visitor spends 5 minutes on a page)
● Viewed a certain element
● Outbound link click
● Video play, etc.
Implement Facebook Standard Event Tracking for Ecommerce
Website action Description Standard event code Parameters Relevant verticals
Add payment info The addition of customer payment <script> ● eCommerce or
information during a checkout process. fbq('track', retail
For example, a person clicks on a 'AddPaymentInfo');
button to save their billing information. </script>
Add to cart The addition of an item to a shopping <script> ● Value ● eCommerce or
cart or basket. For example, clicking fbq('track', ● Currency retail
an Add to Cart button on a website. 'AddToCart'); ● Content_type
</script> ● Content_ids
Or
<script>
fbq('track', 'AddToCart',
{
value: 5,
currency: 'USD',
content_type: 'product',
content_ids: '201'});
</script>
Add to wishlist The addition of items to a wishlist. For <script> ● eCommerce or
example, clicking an Add to Wishlist fbq('track', retail
button on a website. 'AddToWishlist');
</script>
Complete registration A submission of information by a <script> ● e-Learning
customer in exchange for a service fbq('track',
provided by your business. For 'CompleteRegistration');
example, signing up for an email </script>
subscription.
Contact A telephone, SMS, email, chat or other <script> ● Several
type of contact between a customer fbq('track', 'Contact');
and your business. </script>
Customise product The customisation of products through <script> ● Automotive
a configuration tool or other fbq('track', ● Financial
application that your business owns. 'CustomizeProduct'); Services
</script> ● eCommerce
● Travel
Donate The donation of funds to your <script> ● Non-profit
organisation or cause. fbq('track', 'Donate');
</script>
Find location When a person finds one of your <script> ● Automotive
locations via the web, with an intention fbq('track', ● Financial
to visit. For example, searching for a 'FindLocation'); Services
product and finding it at one of your </script> ● eCommerce
local shops. ● Retail
Initiate checkout The start of a checkout process. For <script> ● eCommerce or
example, clicking a Checkout button. fbq('track', retail
'InitiateCheckout');
</script>
Lead A submission of information by a <script> ● Any type of B2B
customer with the understanding that fbq('track', 'Lead'); Business
they may be contacted at a later date </script>
by your business. For example,
submitting a form or signing up for a
trial.
Purchase The completion of a purchase, usually <script> ● Value ● eCommerce or
signified by receiving order or fbq('track', 'Purchase'); ● Currency retail
purchase confirmation, or a </script> ● Content_type
transaction receipt. For example, ● Content_ids
landing on a Thank You or
confirmation page.
Or
<script>
fbq('track', 'Purchase',
{
value: {{dlv - fb -
purchase}},
content_type: 'product',
currency: 'BDT',
content_ids: {{dlv -
product - id}}
});
</script>
Schedule The booking of an appointment to visit <script> ● Financial
one of your locations. fbq('track', 'Schedule'); Services
</script> ● Automotive
● Retail
● Professional
Services
Search A search performed on your website, <script> ● B2C
app or other property. For example, fbq('track', 'Search'); ● B2B
product or travel searches. </script>
Start trial The start of a free trial of a product or <script> ● eCommerce
service you offer. For example, trial fbq('track', ● Entertainment &
subscription. 'StartTrial', {value: Media
'0.00', currency: 'USD', ● Publishing
predicted_ltv: '0.00'});
</script>
Or
<script>
fbq(‘track’,
‘StartTrial’);
</script>
Submit application The submission of an application for a fbq('track', ● Financial
product, service or programme that 'SubmitApplication'); Services
you offer. For example, a credit card, ● Automotive
educational programme or job. ● Education
Subscribe The start of a paid subscription for a fbq('track', 'Subscribe', ● eCommerce
product or service you offer. {value: '0.00', currency: ● Entertainment &
'USD', predicted_ltv: Media
'0.00'}); ● Publishing
● Telco
Or ● Technology
<script>
fbq(‘track’,
‘Subscribe’);
</script>
View content A visit to a web page you care about. <script> ● Value ● Any type of
For example, a product or landing ● Currency Business
page. View content tells you if fbq('track', ● Content_id
someone visits a web page's URL, but 'ViewContent'); ● Content_type
not what they do or see on that web
page. </script>
For the ‘Subscribe’ and ‘StartTrial’ events there are also some recommended
parameters
Parameter Description
value Value of a user performing this event to the business e.g. value for a 3-month plan of $9.99 per month would be $29.97.
predicted_ltv If available, predicted lifetime value of a subscriber as defined by the advertiser and expressed as an exact value.
currency Currency for the value and/or predicted_ltv parameters specified.
<script>
fbq('trackCustom', '30 Seconds');
</script>
Implement Facebook Custom Event Tracking for Ecommerce
Website action Description Standard event code
Time on page When you fire an event after a visitor <script>
spends 2 minutes on a page) fbq('trackCustom', '30 Sec');
</script>
Scroll Depth When a visitor progresses on a page <script>
related to scroll depth (percentages fbq('trackCustom', 'Scroll', {depth: {{Scroll Depth Threshold}}});
of 25, 50, 75 and 100) </script>
Outbound link <script>
click fbq('trackCustom', 'Outbound Link Clicks',{
'Click URL':{{Click URL}},
'Page URL':{{Page URL}}
});
</script>
RegEx ABC (Regular Expressions)
To build a pattern you need to learn the RegEx characters. Here are the characters most frequently used in Google Analytics and Google
Tag Manager (GTM).
RegEx Meaning Example
| or a|b – matches a or b
. any single character a.c – matches abc, acc, adc, …
zero or one previous
? goo?gle – matches gogle and google, but not gooogle
character
zero or more previous
* goo*gle – matches gogle, google, gooogle
characters
one or more previous
+ goo+gle – matches google, gooogle, but not gogle
characters
^ start of the string ^apple – matches apple juice, but not pineapple
$ end of the sting apple$ – matches pineapple, but not apple juice
[a-z] – matches any lowercase letter from a to z
[] list of items to match to
b2[cb] – matches b2c, b2b
Jan(uary)? – matches Jan, January
() group elements
January? – matches Januar, January
[0-9]{2} – matches any two number string from 01 to 99
define character count {x},
{}
{x,y}
[0-9]{1,3} – matches any number string from 1-999
treat RegEx characters like
\ \? – matches a question mark, not zero or one character
normal characters
Standard Events Custom Events Custom conversions
Created by adding to the Facebook pixel Created by adding to the Facebook pixel No extra code required. Created in Ads
base code. base code. Manager using URL and event rules.
Unlimited number of conversion events. Limited to 40 custom events, unlimited Limited to 20 custom conversions per
conversion events. account.
Customized with parameters. Customized with parameters. Customized with granular URL rules.
Aggregated reporting. Aggregated reporting. Separate reporting.
Compatible with dynamic product ads. Not compatible with dynamic product ads. Not compatible with dynamic product ads.
ENHANCED ECOMMERCE DATA LAYER VARIABLE NAMES
1. Transaction Revenue
ecommerce.purchase.actionField.revenue
2. Transaction ID
ecommerce.purchase.actionField.id
3. Transaction Affiliation
ecommerce.purchase.actionField.affiliation
4. Transaction Tax
ecommerce.purchase.actionField.tax
5. Transaction Shipping
ecommerce.purchase.actionField.shipping
6. Transaction Coupon
ecommerce.purchase.actionField.coupon
7. Transaction Currency
ecommerce.currencyCode
Add to cart Event:
gtm4wp.addProductToCartEEC
Purchase Event:
gtm4wp.orderCompletedEEC