Pass Dynamic Purchase Value With Meta Events

If you pass purchase events to Meta via the pixel and API, you may be aware of a challenge: What do you do when the value of the purchase is variable?

Here’s an example of the purchase event code and parameters that you’d use when you know that the price of a product is $147…

fbq('track', 'Purchase', {
value: 147.00,
currency: 'USD'

This is great when the loading of a specific page (like a confirmation page) means that someone purchased a product for $147. It’s no longer useful when that total is variable.

What do you do if you don’t know the total amount spent? What if the customer can add multiple items to their cart prior to completing a purchase? What if the customer can apply promo codes that impact the total order value?

This is where it gets tricky. Let’s discuss the factors that would help you solve this problem…

Dynamic Variable

In simple terms, you need to replace “147.00” above with a dynamic value that represents the total order value.

It might look like this…

fbq('track', 'Purchase', {
value: order_total,
currency: 'USD'

In this example, we replace the dollar amount with a variable that reflects that total. That total will then be injected dynamically.

Of course, I’d love to tell you that your platform utilizes a variable called “order_total.” Unfortunately, it is not universal and what you use is going to be different depending on your platform.

Meta provides the following well-known examples:

'{{ total_price | money_without_currency }}','currency':'USD'





The good news is that if you use any of these solutions, the dynamic value may be passed via the pixel already. Confirm that, but it’s likely the case. So, again, we haven’t solved a problem yet.

The issue comes into play when we have to pass events manually by adding our own event code.

General Solution

Let me start this section by being clear that I am not a web developer. Based on Meta’s documentation and my own research (always dangerous), this is my interpretation of what you need to do.

There do appear to be multiple approaches, but the most common is related to pulling the order total from the confirmation page. This may be your first obstacle.

I use Infusionsoft (Keap). Purchases are made using an Infusionsoft order form. Customers are then redirected to a confirmation page on my website.

We need the Infusionsoft form to pass the order total to the confirmation page and display it. There is actually an Infusionsoft setting when creating order forms to “Pass contact’s information to the Thank You Page.”

Infusionsoft Pass Customer Info

This information should then be passed using URL parameters (characters that are appended to the end of the confirmation page URL).

From what I can tell, when using Infusionsoft, the product price is passed using an ID of “price,” though there may be a different ID for the total if you have multiple items in your cart. You can use that information to display the total on the confirmation page.

Of course, you won’t be able to display that information on the confirmation page without some programming effort.

Consult a Web Developer

I know. I’d love to be able to give you the specific step-by-step instructions to solve this problem, but I can’t. Not only am I not a web developer and I already worry I’ve overstepped my expertise, how exactly this is solved will depend on your platform.

But, pass this post (and Meta’s documentation) on to a developer.

The main steps:

  1. What platform is used for purchases?
  2. What ID is used to define the purchase total?
  3. Pass that total to the confirmation page
  4. Display that total on the confirmation page as a variable (it could probably be hidden)
  5. Pull that variable into the purchase event code that fires on that page

Hope that helps!

Your Turn

Is this a problem that you’ve solved? What did you do?

Let me know in the comments below!