top of page

Visionary Ads

Track purchase dynamic value in FB Ads (code only)

  • Writer: Alex Denshik
    Alex Denshik
  • Mar 29, 2021
  • 1 min read

Note: For Shopify sites, we have a separate post


What you need:


Purchase variables (which store transaction data) vary from website to website, so you'll have to work with your developer to understand your website's variables (except Shopify).


Here are some common examples, it must be placed on the Checkout or Thank You page:



FB Transactions value tracking code for WooCommerce:


<script>

fbq('track', 'Purchase', {

value: <?php echo $order->get_order_total(); ?>

});

</script>



FB Transactions value tracking code for Squarespace:


<script>

fbq('track', 'Purchase', {

value: {orderGrandTotal}

});

</script>



FB Transactions value tracking code for BigCommerce:


<script>

fbq('track', 'Purchase', {

value: %%ORDER_SUBTOTAL%%;

});

</script>



FB Transactions value tracking code for Magento:


<script>

fbq('track', 'Purchase', {

value: <?php echo $amount; ?>

});

</script>



FB Transactions value tracking code for Shopify:


<script>

fbq('track', 'Purchase', {

value: {{ total_price | money_without_currency }},

currency: 'USD',

});

</script>


bottom of page