To assign a dynamic value to your goals you need to apply a small tweak to your Vbout tracking code. The first thing to do is identify the variable used by your cart to display the total amount of the transaction. For example, here are the variables used by some popular shopping carts, until today. (please note these variables might change so you should double check before implementing them blindly):

  • Big Commerce: %%ORDER_AMOUNT%%
  • Shopify: order.total_price
  • Wordpress Woocommerce:  $woocommerce->cart->get_cart_total();
  • Magento: $order->getGrandTotal()
  • Opencart: $this->cart->getTotal();
  • Prestashop: {$cart->getOrderTotal(false)}      //change false to true to include tax in your total

Once you know the variable you can insert it inside the code below:

_vbset.push([‘_ecommerce’, ‘enabled’]);
_vbset.push([‘_type’, ‘custom’]);
_vbset.push([‘_amount’, ‘{DYNAMIC_AMOUNT_GOES_HERE}’]);

 Replace {DYNAMIC_AMOUNT_GOES_HERE} with your cart’s variable to look like this:

_vbset.push([‘_ecommerce’, ‘enabled’]);
_vbset.push([‘_type’, ‘custom’]);
_vbset.push([‘_amount’, ‘%%ORDER_AMOUNT%%’]);

 Now add the snippet above to your Vbout tracking code. The final result should look like this:

<script type=“text/javascript”>
var _vbset = _vbset || [];
_vbset.push([‘_account’, ‘VBT-07274-13’]);
_vbset.push([‘_domain’, ‘http://www.mydomain.com’]);

_vbset.push([‘_ecommerce’, ‘enabled’]);
_vbset.push([‘_type’, ‘custom’]);
_vbset.push([‘_amount’, ‘%%ORDER_AMOUNT%%’]);

(function() {

var vbt = document.createElement(‘script’); vbt.type = ‘text/javascript’; vbt.async = true;
vbt.src = (‘https:’ == document.location.protocol ? ‘https://’ : ‘http://’) + ‘www.vbout.com/tracker?_account=’+_vbset[0][1]+’&_domain=’+_vbset[1][1];var s = document.getElementsByTagName(‘script’)[0]; s.parentNode.insertBefore(vbt, s);
})();