Hi. How can we help?

Custom Thank You Page - How to add Google conversion code

To add Google conversion code on Custom Thank you page you can add a code like this in your theme functions.php

add_action('yith_ctpw_successful_ac','google_conv_code',70);
function google_conv_code( $order ) {
$currency = $order->get_currency();
$total = $order->get_total();
?>
<script type="text/javascript">
/* <![CDATA[ */
var google_conversion_id = 000000000000;
var google_conversion_language = "xx";
var google_conversion_format = "3";
var google_conversion_color = "ffffff";
var google_conversion_label = "xxx";
var google_conversion_value = <?php echo $total; ?>;
var google_conversion_currency = <?php echo $currency; ?>;
var google_remarketing_only = false;
/* ]]> */
</script>
<script type="text/javascript" src="//www.googleadservices.com/pagead/conversion.js">
</script>
<noscript>
<div style="display:inline;">
<img height="1" width="1" style="border-style:none;" alt="" src="//www.googleadservices.com/pagead/conversion/000000000000/?value=<?php echo $total ?>&amp;currency_code=<?php echo $currency; ?>&amp;label=xxx&amp;guid=ON&amp;script=0"/>
</div>
</noscript>
<?php
}

You will have to change the 000000000000, the xx for language and the xxx for the label with the values provided in the script by Google.

Was this article helpful?
0 out of 0 found this helpful

Back to Help Center >

Powered by Zendesk