Send Facebook Pixel Purchase Event via Google Tag Manager
In this article, I will show you how to track the sales generated on your website by Facebook users in Facebook via Google Tag Manager
Following is the process in a nutshell:
Step-1: Deploy Facebook default pixel code on your website via GTM
Step-2: Add data layer on the order confirmation page which pulls sales data from your shopping cart.
Step-3: Pull sales data from the data layer via a data layer variable.
Step-4: Send ‘Purchase’ Facebook event to Facebook along with the sales data.
Step-5: Test the Facebook pixels
Step-6: Add the purchase columns to your Facebook report.
Step #1: Deploy Facebook default pixel code on your website via Google Tag Manager
I have explained this step in great detail in this article: Learn to set up Facebook Tracking via Google Tag Manager
Step #2: Add data layer on the ‘order confirmation’ page which push sales data from your shopping cart
If you are already using a data layer to measure product purchase via enhanced ecommerce tracking then this step is optional.
Otherwise add the following data layer code in the head section (<head>…</head>) of your ‘order confirmation’ page, above the GTM container code:
<script type=”text/javascript”>
dataLayer = [{
‘revenue’: 24.35
}];
</script>
Ask your developer to pull the sales data from your shopping cart on page load.
He is going to add some server side script to the data layer in order to complete this task.
Step #3: Pull sales data from the data layer via a data layer variable
Create a new data layer variable in GTM and name it ‘Product Revenue’.
Use following similar configuration:
This data layer variable is meant to pull sales data from your order confirmation page.
Note: The data layer variable name used in your data layer may be something other than ‘revenue’. If that is the case then use that data layer variable name.
Step #4: Send ‘Purchase’ Facebook event to Facebook along with the sales data
#1 Create a new custom HTML tag in GTM and name it ‘Sending Website Sales generated by Facebook users to Facebook’.
#2 Add following code in the HTML text box:
<script>
fbq(‘track’, ‘Purchase’, {
value: {{Product Revenue}},
currency: ‘USD’
});
</script>
The whole set up may look like the one below:
#3 Click on ‘Advance Settings’ and then click on ‘Tag Sequencing’:
#4 Select the checkbox named ‘Fire a tag before Sending Website Sales generated by Facebook users to Facebook fires’ and then select ‘Facebook default pixel code’ in the ‘Setup Tag’:
Here ‘Facebook default pixel code’ is the tag I created to fire Facebook pixel code via GTM.
You can find more details about creating this tag from this article ‘Learn to set up Facebook default pixel code via Google Tag Manager’
Through ‘tag sequencing’ feature of GTM, I am making sure that the Facebook ‘Purchase’ event is fired after the Facebook default pixel code has fired.
If you try to fire the Facebook ‘Purchase’ event before the Facebook default pixel code is fired then the event will not be triggered.
#5 Select the checkbox ‘Don’t fire Sending Website Sales generated by Facebook users to Facebook if Facebook default pixel code fails’.
The whole set up may look like the one below:
#6 Fire this tag only on the order confirmation page:
#7 Test whether this tag fire on the order confirmation page. If it does then publish the container.
Step #5: Test the Facebook pixels
Navigate to the ‘order confirmation’ page and then with the help of the ‘Facebook Pixel Helper chrome extension’ test whether or not the ‘Facebook default pixels’ and ‘Purchase pixels’ are firing and what sales value is being sent to Facebook:
Note: If the ‘Facebook default pixels’ and/or ‘purchase pixels’ are not firing on the ‘order confirmation page’ then the sales data won’t pass to Facebook.
Step #6: Add the purchase columns to your Facebook report
#1 Navigate to your Facebook Adverts Manager page, click on the ‘Performance’ drop down menu and then select ‘Customise Columns’:
#2 Type ‘Purchase’ in the search box and then select the following three check boxes:
- Purchase (Facebook Pixels)
- Cost Per Purchase (Facebook Pixels)
- Purchase Conversion Value (Facebook Pixels)
Here,
Purchase (Facebook Pixels) => number of purchases.
Cost Per Purchase (Facebook Pixels) => average cost of each purchase.
Purchase Conversion Value (Facebook Pixels) => the total value of the purchase.
How to use Funnels for your Facebook Ad Campaigns
This section is in conjunction with the article ‘How to Setup Funnels in Facebook Ads Manager’ where I described, how to create funnel pages in Facebook Ads Manager, step by step.
Today I am going to show you, how to use funnel pages for your Facebook ad campaigns.
Let us suppose the following are your funnel pages:
https://www.example.com/cart
https://www.example.com/checkout
https://www.example.com/complete
Let us also suppose you created a custom audience for each of these funnel pages (as described in this article How to Setup Funnels in Facebook Ads Manager):
Prospects usually drop off at different steps of a funnel.
Some prospects will exit your sales funnel after viewing your shopping cart page (shopping cart visitors).
Some prospects will exit your sales funnel after viewing your Checkout page (checkout visitors).
Some prospects will not exit your sales funnel and actually complete the purchase and when they complete the purchase they see the order confirmation page hosted on your website (customers).
Now people who are exiting your sales funnel have a high propensity of making a purchase on a return visit to your website provided they are retargeted with the right offer and at the right time.
This is where Facebook custom audiences (based on funnel pages) come in handy.
For example, let us suppose you want to retarget all of your website visitors with Facebook ads who saw the checkout page but who didn’t make a purchase on your website.
Now how you will do that? You can complete this task by using the following two custom audiences:
- Checkout Visitors
- Customers
While creating your ad set in Facebook, set your audience targeting to, like the one below:
Let us suppose you want to retarget all of your website visitors with Facebook ads who saw the shopping cart page but not checkout page and they are also not your existing customers.
Now how you will do that? You can complete this task by using the following three custom audiences:
- Shopping cart visitors
- Checkout visitors
- Customers
While creating your ad set in Facebook set your audience targeting to, like the one below:
Ideally, you should create one Facebook ad set for each funnel page so that you can uniquely retarget prospects at different stages of a sales funnel with different ads and offers.
That’s how you can use funnels in your Facebook ad campaigns.
Other articles on Facebook Pixel Tracking
- facebook.com Referral Traffic in Google Analytics Explained
- Facebook Attribution and Conversion Windows Tutorial
- Facebook ROI Calculation, Analysis and Examples
- How to set up the Facebook Attribution Tool
- How to Setup Funnels in Facebook Ads Manager
- How to use funnels for your Facebook Ad Campaigns
- How to advertise on Facebook for FREE with unlimited budget
- Secret to Setup Facebook Pixel Tracking Correctly in Google Tag Manager
- Facebook Pixel vs Google Analytics Data Discrepancies
- facebook.com Referral Traffic in Google Analytics Explained
- Learn to set up Facebook Pixel via Google Tag Manager
- Open Graph Protocol for Facebook Explained with Examples
- Tracking Facebook ‘Likes’ and ‘Unlikes’ in Google Analytics
- Google Analytics for Facebook Tutorial
- Facebook Attribution Models Tutorial
- GTM Server Side Tagging for Facebook Tutorial
- The impact of Apple IOS 14.5 update on Facebook Ads
- How to add Facebook Pixel to WordPress Website
- How to add Facebook Pixel to WordPress without a Plugin
- How to track Facebook events via Google Tag Manager
- How to use the Facebook Event Setup Tool
- How to use the Facebook Pixel Helper to Test Facebook Events
- How to automatically turn off Facebook ads on weekends
- How to name Facebook Ad Campaigns like a Pro
In this article, I will show you how to track the sales generated on your website by Facebook users in Facebook via Google Tag Manager
Following is the process in a nutshell:
Step-1: Deploy Facebook default pixel code on your website via GTM
Step-2: Add data layer on the order confirmation page which pulls sales data from your shopping cart.
Step-3: Pull sales data from the data layer via a data layer variable.
Step-4: Send ‘Purchase’ Facebook event to Facebook along with the sales data.
Step-5: Test the Facebook pixels
Step-6: Add the purchase columns to your Facebook report.
Step #1: Deploy Facebook default pixel code on your website via Google Tag Manager
I have explained this step in great detail in this article: Learn to set up Facebook Tracking via Google Tag Manager
Step #2: Add data layer on the ‘order confirmation’ page which push sales data from your shopping cart
If you are already using a data layer to measure product purchase via enhanced ecommerce tracking then this step is optional.
Otherwise add the following data layer code in the head section (<head>…</head>) of your ‘order confirmation’ page, above the GTM container code:
<script type=”text/javascript”>
dataLayer = [{
‘revenue’: 24.35
}];
</script>
Ask your developer to pull the sales data from your shopping cart on page load.
He is going to add some server side script to the data layer in order to complete this task.
Step #3: Pull sales data from the data layer via a data layer variable
Create a new data layer variable in GTM and name it ‘Product Revenue’.
Use following similar configuration:
This data layer variable is meant to pull sales data from your order confirmation page.
Note: The data layer variable name used in your data layer may be something other than ‘revenue’. If that is the case then use that data layer variable name.
Step #4: Send ‘Purchase’ Facebook event to Facebook along with the sales data
#1 Create a new custom HTML tag in GTM and name it ‘Sending Website Sales generated by Facebook users to Facebook’.
#2 Add following code in the HTML text box:
<script>
fbq(‘track’, ‘Purchase’, {
value: {{Product Revenue}},
currency: ‘USD’
});
</script>
The whole set up may look like the one below:
#3 Click on ‘Advance Settings’ and then click on ‘Tag Sequencing’:
#4 Select the checkbox named ‘Fire a tag before Sending Website Sales generated by Facebook users to Facebook fires’ and then select ‘Facebook default pixel code’ in the ‘Setup Tag’:
Here ‘Facebook default pixel code’ is the tag I created to fire Facebook pixel code via GTM.
You can find more details about creating this tag from this article ‘Learn to set up Facebook default pixel code via Google Tag Manager’
Through ‘tag sequencing’ feature of GTM, I am making sure that the Facebook ‘Purchase’ event is fired after the Facebook default pixel code has fired.
If you try to fire the Facebook ‘Purchase’ event before the Facebook default pixel code is fired then the event will not be triggered.
#5 Select the checkbox ‘Don’t fire Sending Website Sales generated by Facebook users to Facebook if Facebook default pixel code fails’.
The whole set up may look like the one below:
#6 Fire this tag only on the order confirmation page:
#7 Test whether this tag fire on the order confirmation page. If it does then publish the container.
Step #5: Test the Facebook pixels
Navigate to the ‘order confirmation’ page and then with the help of the ‘Facebook Pixel Helper chrome extension’ test whether or not the ‘Facebook default pixels’ and ‘Purchase pixels’ are firing and what sales value is being sent to Facebook:
Note: If the ‘Facebook default pixels’ and/or ‘purchase pixels’ are not firing on the ‘order confirmation page’ then the sales data won’t pass to Facebook.
Step #6: Add the purchase columns to your Facebook report
#1 Navigate to your Facebook Adverts Manager page, click on the ‘Performance’ drop down menu and then select ‘Customise Columns’:
#2 Type ‘Purchase’ in the search box and then select the following three check boxes:
- Purchase (Facebook Pixels)
- Cost Per Purchase (Facebook Pixels)
- Purchase Conversion Value (Facebook Pixels)
Here,
Purchase (Facebook Pixels) => number of purchases.
Cost Per Purchase (Facebook Pixels) => average cost of each purchase.
Purchase Conversion Value (Facebook Pixels) => the total value of the purchase.
How to use Funnels for your Facebook Ad Campaigns
This section is in conjunction with the article ‘How to Setup Funnels in Facebook Ads Manager’ where I described, how to create funnel pages in Facebook Ads Manager, step by step.
Today I am going to show you, how to use funnel pages for your Facebook ad campaigns.
Let us suppose the following are your funnel pages:
https://www.example.com/cart
https://www.example.com/checkout
https://www.example.com/complete
Let us also suppose you created a custom audience for each of these funnel pages (as described in this article How to Setup Funnels in Facebook Ads Manager):
Prospects usually drop off at different steps of a funnel.
Some prospects will exit your sales funnel after viewing your shopping cart page (shopping cart visitors).
Some prospects will exit your sales funnel after viewing your Checkout page (checkout visitors).
Some prospects will not exit your sales funnel and actually complete the purchase and when they complete the purchase they see the order confirmation page hosted on your website (customers).
Now people who are exiting your sales funnel have a high propensity of making a purchase on a return visit to your website provided they are retargeted with the right offer and at the right time.
This is where Facebook custom audiences (based on funnel pages) come in handy.
For example, let us suppose you want to retarget all of your website visitors with Facebook ads who saw the checkout page but who didn’t make a purchase on your website.
Now how you will do that? You can complete this task by using the following two custom audiences:
- Checkout Visitors
- Customers
While creating your ad set in Facebook, set your audience targeting to, like the one below:
Let us suppose you want to retarget all of your website visitors with Facebook ads who saw the shopping cart page but not checkout page and they are also not your existing customers.
Now how you will do that? You can complete this task by using the following three custom audiences:
- Shopping cart visitors
- Checkout visitors
- Customers
While creating your ad set in Facebook set your audience targeting to, like the one below:
Ideally, you should create one Facebook ad set for each funnel page so that you can uniquely retarget prospects at different stages of a sales funnel with different ads and offers.
That’s how you can use funnels in your Facebook ad campaigns.
Other articles on Facebook Pixel Tracking
- facebook.com Referral Traffic in Google Analytics Explained
- Facebook Attribution and Conversion Windows Tutorial
- Facebook ROI Calculation, Analysis and Examples
- How to set up the Facebook Attribution Tool
- How to Setup Funnels in Facebook Ads Manager
- How to use funnels for your Facebook Ad Campaigns
- How to advertise on Facebook for FREE with unlimited budget
- Secret to Setup Facebook Pixel Tracking Correctly in Google Tag Manager
- Facebook Pixel vs Google Analytics Data Discrepancies
- facebook.com Referral Traffic in Google Analytics Explained
- Learn to set up Facebook Pixel via Google Tag Manager
- Open Graph Protocol for Facebook Explained with Examples
- Tracking Facebook ‘Likes’ and ‘Unlikes’ in Google Analytics
- Google Analytics for Facebook Tutorial
- Facebook Attribution Models Tutorial
- GTM Server Side Tagging for Facebook Tutorial
- The impact of Apple IOS 14.5 update on Facebook Ads
- How to add Facebook Pixel to WordPress Website
- How to add Facebook Pixel to WordPress without a Plugin
- How to track Facebook events via Google Tag Manager
- How to use the Facebook Event Setup Tool
- How to use the Facebook Pixel Helper to Test Facebook Events
- How to automatically turn off Facebook ads on weekends
- How to name Facebook Ad Campaigns like a Pro
My best selling books on Digital Analytics and Conversion Optimization
Maths and Stats for Web Analytics and Conversion Optimization
This expert guide will teach you how to leverage the knowledge of maths and statistics in order to accurately interpret data and take actions, which can quickly improve the bottom-line of your online business.
Master the Essentials of Email Marketing Analytics
This book focuses solely on the ‘analytics’ that power your email marketing optimization program and will help you dramatically reduce your cost per acquisition and increase marketing ROI by tracking the performance of the various KPIs and metrics used for email marketing.
Attribution Modelling in Google Analytics and BeyondSECOND EDITION OUT NOW!
Attribution modelling is the process of determining the most effective marketing channels for investment. This book has been written to help you implement attribution modelling. It will teach you how to leverage the knowledge of attribution modelling in order to allocate marketing budget and understand buying behaviour.
Attribution Modelling in Google Ads and Facebook
This book has been written to help you implement attribution modelling in Google Ads (Google AdWords) and Facebook. It will teach you, how to leverage the knowledge of attribution modelling in order to understand the customer purchasing journey and determine the most effective marketing channels for investment.