I am trying to install the Google Adwords Conversion tag into Wordpress; specifically Woocommerce. We have tried plugins, but had conflicts with other items so we are now trying to manually implement it.
We have the following 'event' tag placed in our functions.php file:
add_action( 'woocommerce_thankyou', 'conversion_tracking_thank_you_page' );
function conversion_tracking_thank_you_page() {
?>
<!-- Event snippet for Transaction conversion page -->
<script>
gtag('event', 'conversion', {
'send_to': 'AW-######/######',
'value': 1.0,
'currency': 'USD',
'transaction_id': '
});
</script>
<?php
}
It pulls correctly, but, all transactions default to $1. We have this set to revert to $1 if there is no transaction value, however we want to pull the transaction value from Woocommerce. I have searched everywhere, and cannnot find the correct code for the event tag specifically, to pull this value from Woocommerce.