Hi guys,
I'm trying to add a google conversion code like the one following in success page but I'm able to see it only in firefox. Any idea or suggestion about this issue?
<!-- Event snippet for conversion page --> <script> gtag('event', 'conversion', { 'send_to': 'xxx/xxx', 'transaction_id': '' }); </script>
Hi @angelo_palumbo ,
If your website in magento 1, please use following code in success page ,
<?php $OrderId = Mage::getSingleton('checkout/session')->getLastOrderId(); $Order = Mage::getModel('sales/order')->load($OrderId); $incrementId = $Order->getIncrementId(); ?> <script> gtag('event', 'conversion', { 'send_to': 'XX-XXXXXXXXX/XXXXXXXXXXXXXX', 'value': <?php echo number_format($Order->getSubtotal(),2,".",""); ?> , 'currency': 'GBP', 'transaction_id': <?php echo "'".$incrementId."'"; ?> }); </script>
OR
if your website in magento 2, open this link and follow those steps
https://github.com/mageplaza/magento-2-google-analytics
------------------------------------------------
If you've found one of my answers useful, please give"Kudos" or "Accept as Solution"
Thanks. I'll try it asap.
---edit--- I tried and it keeps to don't work in chrome.
In firefox works
you can try this code
<script type="text/javascript"> /* <![CDATA[ */ //add or insert your code /* ]]> */ </script>