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

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 type="text/javascript" src="//www.googleadservices.com/pagead/conversion.js">
<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"/>

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 1 found this helpful

Back to Help Center >