Jump to content
  • Checkout
  • Login
  • Get in touch


The e-commerce.

Adwords COnversion Tracking


Recommended Posts

  • 2 weeks later...

I am using this also for both Signups and Sales. My only question is how can I pass the Sales value (the amount of the sale) onto Google for the conversation. I know that this is possible (as google explains) but I do not know the value string to use. Righ tnow I have each sale counting as "1" which is ok because it tells me how many sales I have received, but I'd rather know in terms of dollars.



Link to comment
Share on other sites

i started working on some code.. but need help as well :)

i need help on getting the tax rate and how to insert the tracking image only when a user came thru a google ad. would be interessting how to insert the customers language dynamicly into the google converstion script too.

the value submitted to google is the products total without shipping costs.

The code is for testing only, so backup!


in ../catalog/checkout_process.php


// google conversion tracking --------------------
 $ot_tracking = 0;
 for ($i=0, $n=sizeof($order->products); $i<$n; $i++) {
// incl.tax
   $ot_tracking += $order->products[$i]['final_price'] * 1.16 * $order->products[$i]['qty'];
// excl. tax
// $ot_tracking += $order->products[$i]['final_price'] * $order->products[$i]['qty'];
 $ot_tracking = tep_round($ot_tracking, 2);
// ---------------------------------------------------------------

1.16 is my tax rate, how can i dynamicly get the tax there?


in ../catalog/checkout_success.php right below

           <td align="center" width="25%" class="checkoutBarFrom"><?php echo CHECKOUT_BAR_DELIVERY; ?></td>
           <td align="center" width="25%" class="checkoutBarFrom"><?php echo CHECKOUT_BAR_PAYMENT; ?></td>
           <td align="center" width="25%" class="checkoutBarFrom"><?php echo CHECKOUT_BAR_CONFIRMATION; ?></td>
           <td align="center" width="25%" class="checkoutBarCurrent"><?php echo CHECKOUT_BAR_FINISHED; ?></td>



<!-- ----------------------------------------------------------------------------------- -->
<table border="0" width="100%" cellspacing="0" cellpadding="0">
<tr><td align="right" width="100%"><br><br>
<!-- Google Conversion Code -->
<script language="JavaScript">
google_conversion_id = xxxxxxxxxxx;
google_conversion_language = "de";
if (<?php echo $ot_tracking; ?>) {
 google_conversion_value = <?php echo $ot_tracking; ?>;
google_conversion_label = "Purchase";
<script language="JavaScript" src="https://www.googleadservices.com/pagead/conversion.js">
<a href="https://services.google.com/sitestats/de.html" target=_blank>
<img height=27 width=135 src="https://www.googleadservices.com/pagead/conversion/xxxxxxxxxx/?value=<?php echo $ot_tracking; ?>&label=Purchase&hl=de">
<!-- ----------------------------------------------------------------------------------- -->

you have to change the xxxxxxxxxx and the language de to en_US for example. xxxxxxxxxxx is your google id


and somewhere at the end of checkout_success.php

// google conversion tracking -------------------------
// --------------------------------------------------------------------


let me know if you are able to improve my code :)






Link to comment
Share on other sites

  • 1 month later...

Stephan - Is this code working for you? I just launched my site and am just starting a Google campaign. I'm spending a lot of money on the front end to get as many numbers as I can to make revenue and budget projections. Definitely need as much info as possible before I flush all my extra pocked change away!!!



Link to comment
Share on other sites

  • 1 year later...
It did not work for me last month when I tried it, I kept getting javascript errors when the page loaded, so if anyone gets it working, please share the code.





Does anyone know what was the end result of this topic? I'm also interested in the dynamic code for Google. Thanks!

Link to comment
Share on other sites


This topic is now archived and is closed to further replies.

  • Create New...