0

My online store uses WHMCS.

I have the Google Analytics WHMCS app installed and configured.

I'm setting up a Google Ads campaign to send clicks to my store, and during Google Ads conversion setup, they've given me the following code to track conversions on my WHMCS site.

<script>
  gtag('event', 'conversion', {
      'send_to': 'AW-xxx/xxx',
      'value': 10.0,
      'currency': 'AUD',
      'transaction_id': ''
  });
</script>

I've added this to templates/orderforms/standard_cart/complete.tpl

During the Google Ads conversion setup, they asked for a default conversion value which I set to AU$10.

How do I dynamically set the value assigned to the Google Ads conversion based on the order that has just been made on the order-complete page?

1 Answer 1

0

The solution was to use {$amount}, a WHMCS template variable, for the value, so it gets replaced with the amount before the page is sent to their browser.

<script>
  gtag('event', 'conversion', {
      'send_to': 'AW-xxx/xxx',
      'value': {$amount},
      'currency': 'AUD',
      'transaction_id': ''
  });
</script>

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.