Facebook pixel tracking

In this article, we’re going to look at setting up Facebook pixel tracking in your products and funnels.

For your checkouts, your main scripts area is managed under your product settings in the Checkout > Tracking tab. By enabling this option and checking the box, you’ll be shown multiple fields. These fields will automatically adjust based on things like having multiple payment options (field 3) or having a bump offer (field 4) enabled on your checkout.

Basic page view tracking

To install a Facebook Pixel, you need to paste the ‘Base Pixel code’ into Field 1 in your product’s settings (see above image for Field 1 identification).

You can get your Facebook pixel code from your Facebook Ads Manager.

Copied and pasted into ThriveCart:

The code entered into Field 1 will be loaded across ALL pages in your funnel. This includes your main checkout page, any upsells/downsells, and your ThriveCart hosted success page.

If you’re wanting to track a Facebook event when a user lands on the checkout page specifically, then you can add an event code into Field 2 in your checkout tracking fields.

The specific event can be chosen in the same area where you get your Facebook pixel from. Facebook gives you a range of options on the next step and in this example below we want to add an InitiateCheckout event when the user lands on the cart page.

We can look at adding conversion values and currencies, these would be added to the fields and Facebook would automatically update the code to add to your checkout page.

Then in your product settings, this would look like:

Tracking purchase events

Tracking when a customer purchases your product, bump, upsells or downsells, this is also very easy to do. You must be using the ThriveCart hosted success page in order for this to work. If you are redirecting to your own custom success page, then you will want to load Facebook purchase events on your own pages.

Like above, with the InitiateCheckout event from Facebook, you can also get purchase events which look like this:

Now, obviously, this basic method would mean that you’d need to manually enter the purchase amount and currency for each product you add this code to.

To make things really easy for you, we’ve got some variables that can be used for the conversion value and currency which will then pull the order value and currency from the system automatically.

You’ll want to use these scripts below:

Tracking the purchase of your main product:

<script>fbq('track', 'Purchase', {value: _thrive_order.order.product.total_readable, currency: _thrive_order.order.currency});</script>

This would then be added to Field 3 in your products tracking area.

If you check the box to only run the code the first time the customer gets to the success page, this will prevent the code from running in the future if the customer clicks the link in their receipt email. This will help prevent duplicate purchase events for the same customer being run.

Tracking the purchase of your bump offer product:

<script>fbq('track', 'Purchase', {value: _thrive_order.order.bump.total_readable, currency: _thrive_order.order.currency});</script>

This would be added to Field 4 in your products tracking area.

Again, if you check the box to only run the code the first time the customer gets to the success page, this will prevent the code from running in the future if the customer clicks the link in their receipt email. This will help prevent duplicate purchase events for the same customer being run.

Upsells & downsell tracking

When it comes to your upsells and downsells, they have their own tracking scripts area in their individual products settings.

In this case, we do not need to add the Facebook base pixel for tracking. As that was added to your main product, if you attach an upsell to your funnel, it will automatically have the base Facebook pixel added to it.

You can use Field 1 to run code unique to the upsell page and code that will only run on this upsell page.

Tracking the purchase of your upsell product. Note! You must replace ‘UPSELL_ID_HERE’ in the code with the ID of your upsell, which is the number at the very end of the URL that you go to when editing the upsell.

<script>fbq('track', 'Purchase', {value: _thrive_order.order.upsells[UPSELL_ID_HERE].total_readable, currency: _thrive_order.order.currency});</script>

For example, the below upsell is 53 in my account. So the script would look like it does below.

If you check the box to only run the code the first time the customer gets to the success page, this will prevent the code from running in the future if the customer clicks the link in their receipt email. This will help prevent duplicate purchase events for the same customer being run.

Tracking the purchase of your downsell product. Note! You must replace ‘DOWNSELL_ID_HERE’ in the code with the ID of your downsell, which is the number at the very end of the URL that you go to when editing the downsell.

<script>fbq('track', 'Purchase', {value: _thrive_order.order.downsells[DOWNSELL_ID_HERE].total_readable, currency: _thrive_order.order.currency});</script>

This works in the same way as your upsells as discussed above.

Please note that the purchase events are only triggered when using ThriveCart’s hosted success page. As we control the scripts and content embedded on these pages.

If you are redirecting to your own custom success page, these codes will not be loaded consistently as your customers will often be redirected away before the codes have time to load.

If you are wanting to use purchase tracking events and your own success page you will need to embed these codes on your own page. ThriveCart provides details about your customer’s order via the query string, so it is possible to load specific scripts based on your customer’s purchases (if your funnel has multiple products). 

Related Articles