I am trying to implement a Google Tag from the PPC account of my clients. This code is on my sales conversion page. I believe I am along the right lines, but I'm not confident my PHP will pull in the correct Magento data.
I wish to insert the Value of the conversion and the Transaction ID.
<!-- Event snippet for Sales conversion page -->
<?php
$order_details = Mage::getModel('sales/order')->loadByIncrementId(Mage::getSingleton('checkout/session')->getLastRealOrderId());
$adwords_saleamt = $order_details->subtotal;
$transaction = Mage::getModel('sales/order_payment_transaction');
$transaction_id = $transaction->setOrderId(1);
?>
<script>
gtag('event', 'conversion', {
'send_to': 'XX-XXXXXXXXX/XXXXXXXXXXXXXX',
'value': '<?php echo $adwords_saleamt; ?>',
'currency': 'GBP',
'transaction_id': '<?php echo $transaction_id; ?>'
});
</script>