Is your Facebook Pixel optimized to track conversions separately from regular events?
Your conversions are the most important events that you can track on your website. But if you’re not using the Facebook Pixel’s Purchase Tracking feature, you could be missing out on important conversion data.
In the last guides, we have set up our Facebook Base Tracking Pixel and Custom Event Tracking. Now we need to tell Facebook what to optimize for.
That’s why we need to set up Facebook Pixel Conversion Tracking also called Purchase Tracking in Facebook Ads. Thus, we will set up Facebook Pixel Conversion Tracking and transfer the value of our conversion to Facebook.
An overview of what we’ll cover in this guide:
- The Purchase Event Explained
- How to Set Purchase Amount Dynamically in GTM
- Creating a Facebook Custom Conversion
- Submit Changes and Publish
So let’s dive in.
The Purchase Event Explained
Welcome back to our demo shop. In our last guide, we have already installed our Facebook Base Pixel, which you need to have installed in order for other interactions to be picked up.
I re-installed the Pageview event and the Add To Cart event on button clicks of the Add to Cart button.

Now, there is one thing that is missing, which is very important for Facebook ads i.e. purchase tracking. For this, go to Set up and then click Manually Install the Code Yourself.

We have already installed this Facebook Base Pixel code on our page and if you click Continue, you have the custom events.

For conversion tracking, we want to select the Purchase event. For the Purchase event, you simply deploy the tracking code.
How to Set Purchase Amount Dynamically in GTM?
If you have a conversion value for example of 99 dollars, and currency as USD, it will make your data much better. The currency is usually not changing but sometimes could be dynamic as well.

Thus, it is obvious that not all of our purchases should be marked as 99 dollars. You would need to dynamically insert this with the help of Google Tag Manager. So just to give you an example, let’s go back to our demo shop and buy a product.
In any online store, you would land on an order received page, or a thank you page, where you would normally see how much you have spent on your order.

This is the amount that we want to send over to Facebook and dynamically fill into the event that we send to Facebook.
How can we get the amount into Google Tag Manager dynamically? Well, there are different methods and we have discussed them in our guide on Conversion Values.
The most robust way is to build a custom data layout.
Now since I’m here on a Woocommerce store, I’ve installed a plugin by Thomas Geiger, which is the Google Tag Manager for WordPress. This plugin will fill the data layer for you automatically if you are on a website.
In order to see the data layer, and where the information is, we need to enter our preview and debug mode. To do this, click the Preview button.

So let’s do that and then go through another conversion. Once I’m back on the thank you page, I can look into my data layer and see how it was filled with values.
In our case, we have this huge data layer push, which is the gtm4wp.orderCompletedEEC. You can note that the transactionTotal here resembles the total amount that was bought by the user.
You also have a transactionCurrency in here, which you could use if you had different currencies in your store. In our case, that doesn’t really change so I won’t pull this from the data layer.

Create Data Layer Variable
I’m just going to try to pull the transaction total from the data layer. To do this, I will build a variable in Google Tag Manager.

Now variables are like place holders, so you can build them dynamically to pull them from places like the data layer. I will Choose variable type as a Data Layer Variable and this will allow me to access the information from the data layer.

Give this variable a name. We have named it as dlv-transactionTotal. The only configuration needed is the Data Layer Variable Name.
That is the key that we see in the Javascript object. So in our case, it will be transactionTotal. Click on Save and we have this now available in the Google Tag Manager as a variable.

Set-up FB Purchase Event Tag
What does that mean? And where can we use them?
Well now, we can go to the next step and copy our JavaScript code.
<script>
fbq('track', 'Purchase', {
value: 99,
currency: "USD",
});
</script>

We then implement this as a New Tag. Here, we will select a Custom HTML tag.

Give the Tag a name and as the HTML code , paste the JavaScript code that you had copied.

Now we need to customize this because we don’t want all our products to result in 99 dollars once this fires.
So we will dynamically insert our variable, which can be done with two curly brackets. This opens up a menu with all your different variables in here. You can click on our dlv-transactionTotal, and that should be replaced dynamically with whatever is in the data layer at that time.

Create Conversion Trigger
Next, we can build a trigger and we would want to deploy that on our final checkout page. Thus, we could look at the URL and would want to deploy this on our order-received page if that is in the URL.

We’re going to click on the plus sign ( + ) here and create a new trigger.

We will fire this on the pageview tag of our thank you page and name this pv – Thank You.

Now, this will be the Page View tag.

But this trigger will only fire on Some Page Views, where the Page URL contains our order-received. Let’s Save the trigger.

Testing
We’re almost done! Now we just need to deploy and test our Tag.
Save our Facebook Purchase Pixel.

Now, Refresh our page.

Let’s go through another conversion. Here, when we get to our Order received page, we see that our Fb – Event – Purchase tag has fired.

Now, in our Facebook Pixel Helper, we see that Purchase information was transferred with the value of 45.00.
This corresponds dynamically to the Checkout total that was inserted through our variable with the amount of 45. Thus, this works as expected.

Let’s move over to our Facebook Analytics, and go into the Event Debugging. Again, we see an Event Purchases that was fired with the value of 45.

Creating a Facebook Custom Conversion
Now in Facebook itself, we could use this for our Custom Conversions. Thus, you could create a New Custom Conversion.
For this, click on Custom Conversions→Create Custom Conversion in your Facebook Pixel.

Here, choose Purchase Event as a Custom Conversion.

And once this is set up, you will be able to get columns filled that correspond to the conversion value of your campaigns. For example, in the Ads Manager, if you have a campaign, you should be able to see the actual conversion value, in a column, that you can add in your Ads account.
Go to Ads Manager → Add other columns… and select Total Conversion Value.

Thus, this column should be filled with the amount that is transferred later on. This will give you some more data on how many clicks you received and how much money you made in the end. So, you will have a meaningful dataset in your account.
Submit Changes and Publish
Now don’t forget that this is currently running on only our browser. We still need to deploy this as a version so that the Tag will fire for all users. To do that you can click the Submit button.

Now, enter a Version Name, and Publish this to all your users so it is live on your website. Thus, this is how you set up Facebook Pixel Conversion Tracking for purchases.

Summary
Alright, so there you have it! This is how you can set up Facebook Pixel conversion tracking for various user actions with the help of Google Tag Manager. In this guide, we learned how to set it up particularly for Purchase tracking.
This brings us to the end of this series on Facebook Pixel tracking. Please feel free to leave your comments below.
If you’re new to Facebook Pixel tracking, you can start with our first guide on Facebook Base Tracking Pixel. If you’re new to Google Tag Manager, we also have a free course for you to get started!
Hi Julian, many thanks for your great tutorial. I have 2 questions.
– In this video you advise to use Thomas Geiger’s plugin, but it requires the GTM ID in the settings therefore I suppose it means this will install the GTM code in the header and the body. So I have to remove my manual installation?
– In this video you started to set the purchase custom conversions up, but you just chose the event “Purchase” and after that you close the window, could you please explain how to set it up properly please?
Thank you.
Billy
the plugin now has a setting to just use the dataLayer function without deploying GTM.
not sure what you mean by properly?
Thank you Julian for your reply, I found the option. And for the second one, I mean could you please explain the full process for setting up the “Purchase” event you start in the video?
please take a look at the first and second part of the video
be useful if you added the links here so people can find them easily
only part 3 shows when u do a seach ..