1

I've create a custom module to collect customer data and return it back to Google at success page.

In my module success.phtml :

<?php
/** @var \Chic\Google\Block\Success $block */
?>
<h1><?= $block->getGrandTotal() ?></h1>

<script>
  gtag('event', 'conversion', {
      'send_to': 'AW-11109313262/QKkuCMyiuqAYEO7VqrEp',
      'value': '',
      'currency': 'SAR',
      'transaction_id': ''
  });
</script>

Now at success page the grand total already appear but the script is not available when I check page source through my browser !

enter image description here

Could you please advise what I've to do ?

1 Answer 1

0

These are the few things you need to verify:

  • Path will be this to override the template.

    app/design/frontend/Vendor/ThemeName/Magento_Checkout/templates/success.phtml

and you need to include the script inside these tags this way :

<script type="text/javascript" async="true">


</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.