- install the Google Tag Manager plugin on your WooCommerce website.
- Create a new tag in Google Tag Manager for the conversion data you want to send to Google Ads.
- In the Tag Configuration section, select “Google Ads Conversion Tracking” as the tag type.
- Enter your Google Ads Conversion ID and Conversion Label in the appropriate fields.
- In the “Triggering” section, create a new trigger for the “Thank You” page of your WooCommerce site.
- Save and publish your tag and trigger in Google Tag Manager.
to pass the Value of the conversion
- In Google Tag Manager, navigate to the Google Ads Conversion Tracking tag that you created earlier.
- In the “Tag Configuration” section, scroll down to the “Value” field.
- In the “Value” field, you can enter a fixed value (e.g. “10” for $10) or you can use a variable to dynamically pass a value from the page (e.g. “{{transaction_total}” to pass the total sale amount).
- Make sure to save and publish the changes in GTM.
please also add the below function in functions.php
<?php
add_action( ‘woocommerce_thankyou’, ‘add_transaction_total_to_data_layer’ );
function add_transaction_total_to_data_layer( $order_id ) {
$order = wc_get_order( $order_id );
$transaction_total = $order->get_total();
?>
<script>
dataLayer.push({‘transaction_total’: <?php echo $transaction_total; ?>});
</script>
<?php
}
?>
please don’t forget to create a variable in GTM that pulls the value from the data layer. (transaction_total)