Zen Cart Logo
Forums / General Questions / Google Adwords Conversion Tracking code help.

Google Adwords Conversion Tracking code help.

Views: 29,554

Results 1 to 20 of 40
23 Nov 2006, 3:18 PM
#1
wondergirl avatar

wondergirl

Zen Follower

Join Date:
Jul 2005
Posts:
108
Plugin Contributions:
0

Google Adwords Conversion Tracking code help.

I want to insert the google adwords conversion tracking code on my checkout success page which would be /includes/languages/english/checkout_success.php

Now, would the code:

<!-- Google Code for purchase Conversion Page -->
<script language="JavaScript" type="text/javascript">
<!--
var google_conversion_id = MY UNIQUE CODE NUMBER;
var google_conversion_language = "en_US";
var google_conversion_format = "1";
var google_conversion_color = "F0E0D1";
if (1) {
  var google_conversion_value = 1;
}
var google_conversion_label = "purchase";
//-->
</script>
<script language="JavaScript" src="http://www.googleadservices.com/pagead/conversion.js">
</script>
<noscript>
<img height=1 width=1 border=0 src="http://www.googleadservices.com/pagead/conversion/MY UNIQUE CODE NUMBER/?value=1&label=purchase&script=0">
</noscript>

work in that checkout_success.php page without any other modifications?

Thank you in advance.

25 Nov 2006, 12:31 PM
#2
wondergirl avatar

wondergirl

Zen Follower

Join Date:
Jul 2005
Posts:
108
Plugin Contributions:
0

Re: Google Adwords Conversion Tracking code help.

It's been a couple of days and there has not been any answer to this thread, so I thought I'd drop in to check again if anyone knows. I still cannot figure it out.
Thanks in advance.

3 Dec 2006, 2:36 PM
#3
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,513
Plugin Contributions:
176

Re: Google Adwords Conversion Tracking code help.

yes, just paste that code into a new file, called /includes/modules/pages/checkout_success/jscript_google_purchase.js

Without any modifications, you'll get a value of "1" submitted for each time someone gets to the checkout-success page.

If you want something other than "1", you'll have to customize code.

3 Dec 2006, 3:20 PM
#4
wondergirl avatar

wondergirl

Zen Follower

Join Date:
Jul 2005
Posts:
108
Plugin Contributions:
0

Re: Google Adwords Conversion Tracking code help.

Thank you so much DrByte! I'll try this out! Now if only they would send some business my way huh? LOL

8 Dec 2006, 6:46 PM
#5
toosquare avatar

toosquare

New Zenner

Join Date:
Jul 2005
Posts:
26
Plugin Contributions:
0

Re: Google Adwords Conversion Tracking code help.

"yes, just paste that code into a new file, called /includes/modules/pages/checkout_success/jscript_google_purchase.js"

Hello,

I have read other posts that say to call the file like jscript_google.php does it matter, even for older version of zencart?

Thanks

14 Dec 2006, 6:39 PM
#6
elfboy avatar

elfboy

New Zenner

Join Date:
Sep 2005
Posts:
79
Plugin Contributions:
0

Re: Google Adwords Conversion Tracking code help.

toosquare:

Hello,

I have read other posts that say to call the file like jscript_google.php does it matter, even for older version of zencart?

Thanks

toosquare, you are correct! I just tried it with 2 sites (1.2.5 and 1.3.0.2) and they both did NOT work with the file named with .js but did work when named with .php
Thanks for the tip! :wink2:

18 Dec 2006, 7:43 PM
#7
jivananda avatar

jivananda

New Zenner

Join Date:
Oct 2006
Posts:
10
Plugin Contributions:
0

Re: Google Adwords Conversion Tracking code help.

Aloha,

I'm trying to get my conversion tracking to work. I have the code appearing on the page, but want the conversion to include the value of the conversion (ie the total of the order). What is the variable for the total of the order at the checkout_success page?

I've tried <?php echo TEXT_YOUR_TOTAL; ?> but that doesn't work.

Any help is appreciated.

28 Dec 2006, 7:32 PM
#8
socalpatch avatar

socalpatch

New Zenner

Join Date:
May 2006
Posts:
13
Plugin Contributions:
0

Re: Google Adwords Conversion Tracking code help.

Jivananda and all,
I just finished a chat with Google and to change the value for the order in their code, find the line in the code that reads:

if (Total_Cost) {
var google_conversion_value = 1;
}

and change the value to:

if (Total_Cost) {
var google_conversion_value = Total_Cost;
}

This will then return the total amount of the order placed through your cart. Hope that helps.

2 Jan 2007, 3:28 AM
#9
jivananda avatar

jivananda

New Zenner

Join Date:
Oct 2006
Posts:
10
Plugin Contributions:
0

Re: Google Adwords Conversion Tracking code help.

I have figured out how to get the total if anyone is interested:

put the following in the jscript_google.php file as mentioned before:

<?php ##Table: zen_orders ##Field: order_total ## is the order id $orders_query = "SELECT * FROM zen_orders WHERE orders_id = " . $zv_orders_id ." LIMIT 1"; $orders = $db->Execute($orders_query); $order_total = $orders->fields['order_total']; ?> <!-- Google Code for purchase Conversion Page --> <script language="JavaScript" type="text/javascript"> <!-- var google_conversion_id = <your conversion id>; var google_conversion_language = "en_US"; var google_conversion_format = "1"; var google_conversion_color = "6633CC"; if (<?php echo $order_total ?>) { var google_conversion_value = <?php echo $order_total ?>; } var google_conversion_label = "purchase"; //--> </script> <script language="JavaScript" src="https://www.googleadservices.com/pagead/conversion.js"> </script> <noscript> <img height=1 width=1 border=0 src="https://www.googleadservices.com/pagead/conversion/<your conversion id>/?value=<?php echo $order_total ?>&label=purchase&script=0"> </noscript>

And it works!

2 Jan 2007, 9:18 AM
#10
alex_clarke avatar

alex_clarke

Totally Zenned

Join Date:
Mar 2006
Posts:
909
Plugin Contributions:
1

Re: Google Adwords Conversion Tracking code help.

Can't you just subscribe to Google Analytics and install the Google Analytics contribution for Zen Cart?

Then you should get full stats and adword tracking! :)

4 Jan 2007, 4:28 AM
#11
vector0319 avatar

vector0319

New Zenner

Join Date:
Jan 2007
Posts:
1
Plugin Contributions:
0

Re: Google Adwords Conversion Tracking code help.

Alex Clarke:

Can't you just subscribe to Google Analytics and install the Google Analytics contribution for Zen Cart?

Then you should get full stats and adword tracking! :)

You get full stats but not conversion tracking which is what he is going for here. BTW Thanks alot for figuring this out as it is a huge help for keeping track of ROI.

Jeremy

5 Jan 2007, 7:50 PM
#12
jivananda avatar

jivananda

New Zenner

Join Date:
Oct 2006
Posts:
10
Plugin Contributions:
0

Re: Google Adwords Conversion Tracking code help.

vector0319:

You get full stats but not conversion tracking which is what he is going for here. BTW Thanks alot for figuring this out as it is a huge help for keeping track of ROI.

Jeremy

Aloha,

Thanks for answering that question. I wasn't sure, but suspected conversion tracking was totally separate. I do want to install the google analytics module too to get even more stats, but really needed to be able to track ROI right away. I was suprised this conversion tracking solution hadn't been discussed and posted before.

30 Jan 2007, 4:12 AM
#13
kaylala avatar

kaylala

New Zenner

Join Date:
Apr 2006
Location:
Baltimore
Posts:
41
Plugin Contributions:
0

Re: Google Adwords Conversion Tracking code help.

Hi,

I followed the instructions in this post and it worked! Only question now is: is there a way to control where on the page the "Google Site Stats - send feedback" appears? Currently, it appears in the upper left (just off center) of the page.

thanks!

6 Apr 2007, 9:37 PM
#14
danielle avatar

danielle

Totally Zenned

Join Date:
Oct 2004
Posts:
973
Plugin Contributions:
0

Re: Google Adwords Conversion Tracking code help.

Jivananda:

I have figured out how to get the total if anyone is interested:

put the following in the jscript_google.php file as mentioned before:

<?php ##Table: zen_orders ##Field: order_total ## is the order id $orders_query = "SELECT * FROM zen_orders WHERE orders_id = " . $zv_orders_id ." LIMIT 1"; $orders = $db->Execute($orders_query); $order_total = $orders->fields['order_total']; ?> <!-- Google Code for purchase Conversion Page --> <script language="JavaScript" type="text/javascript"> <!-- var google_conversion_id = <your conversion id>; var google_conversion_language = "en_US"; var google_conversion_format = "1"; var google_conversion_color = "6633CC"; if (<?php echo $order_total ?>) { var google_conversion_value = <?php echo $order_total ?>; } var google_conversion_label = "purchase"; //--> </script> <script language="JavaScript" src="https://www.googleadservices.com/pagead/conversion.js"> </script> <noscript> <img height=1 width=1 border=0 src="https://www.googleadservices.com/pagead/conversion/<your conversion id>/?value=<?php echo $order_total ?>&label=purchase&script=0"> </noscript>

And it works!

I tried this but it's not counting anything now. Does anyone have the conversion value working correctly?

Thanks!

9 Apr 2007, 2:43 AM
#15
jivananda avatar

jivananda

New Zenner

Join Date:
Oct 2006
Posts:
10
Plugin Contributions:
0

Re: Google Adwords Conversion Tracking code help.

Danielle:

I tried this but it's not counting anything now. Does anyone have the conversion value working correctly?

Thanks!

Aloha,

It doesn't seem to be working for me either. I get the conversions, but not the ROI for some reason. I finally got the zen cart Google Analytics contribution installed. I highly recommend doing that first. You get a ton of info including $ of revenue based on the source of the sale, including from a google adwords campaign if that is in the same account. I'm not getting any conversions right now so can't tell if it is working well in that area.

Good luck.

Yogi Jivanandanatha

29 Apr 2007, 8:43 PM
#16
bradlawson avatar

bradlawson

New Zenner

Join Date:
Oct 2005
Posts:
71
Plugin Contributions:
0

Re: Google Adwords Conversion Tracking code help.

jivananda,

Do you know why the code you gave stopped working? Jan2 you said everything was working and now it is not. Just checking

Thanks,

Brad

2 May 2007, 9:15 PM
#17
jivananda avatar

jivananda

New Zenner

Join Date:
Oct 2006
Posts:
10
Plugin Contributions:
0

Re: Google Adwords Conversion Tracking code help.

Aloha,

It still works for me, I just did a test order after clicking on my google ad. ROI now appears too, since I installed the Google Analytics plugin into zencart. Strangely, though, I am not getting any outside conversions, even though it "feels" like I am getting more orders from my ads.....

I redownloaded googles code snipet and found a minor difference from what I posted. But either one works fine.

<img height=1 width=1 border=0 src="https://www.googleadservices.com/pagead/conversion/<your conversion id>/**imp.gif**?value=<?php echo $order_total ?>&label=purchase&script=0">

I hope that answers your question.....

20 Jul 2007, 1:42 PM
#18
alan_powerbrixx avatar

alan_powerbrixx

New Zenner

Join Date:
Jul 2007
Location:
Durham, NC
Posts:
56
Plugin Contributions:
0

Re: Google Adwords Conversion Tracking code help.

I want to thank the contributors to this thread for their pointers on getting Google AdWords conversion to include the dollar value. This is my first post to this forum, which I joined to asked the following:

I have a couple of remaining concerns about this code. I had to do things my own way, and I wondered why some of the methods shown here didn't work directly. And after getting it to appear in the page source view correctly, it still doesn't display Google's required notification image (imp.gif I think?).

I'm not sure yet whether it actually reports back to Google, as we don't get conversions every day on this site so I can't yet verify the results in AdWords itself. (I'm reluctant to click and ad and run a test order through the system as that will skew the reporting somewhat, but I may have to if I don't see any conversions in a reasonable amount of time.)

My first deviation from the examples in this thread was, I was not able to place my conversion snippet into a separate file such as /includes/modules/pages/checkout_success/js_google_code.php. Instead, I inserted the code directly into a template-override copy of the tpl_checkout_success_default.php file itself (includes/templates/<my_template_name>/templates/tpl_checkout_success_default.php).

Secondly, there seemed to be two different examples shown in this thread, and neither worked for me exactly as given. What I did was to insert code in two places. I placed an SQL call just below the comments at the top of the page before the first ?> to retrieve the order's subtotal value, like so:

...
 * @version $Id: tpl_checkout_success_default.php 5407 2006-12-27 01:35:37Z drbyte $
 */

[B]// Lookup order subtotal to report to Google AdWords on conversion (see bottom of this code file)
$orders_query = 'SELECT * FROM orders_total WHERE orders_id = ' . $zv_orders_id . ' AND 
class = "ot_subtotal"';
$orders = $db->Execute($orders_query);
$order_subtotal = $orders->fields['value'];[/B]

?>
...

This of course depends on the ot_subtotal module being turned on in Admin > Modules > Order Total. I placed Google's snippet at the bottom of the file, where it is followed only by the similar Yahoo! Search Marketing snippet. The Google AdWords snippet looks like this:

..```
.

<!-- Google AdWords Conversion Code --> <script language="JavaScript" type="text/javascript"> <!-- var google_conversion_id = <my_conversion_id>; var google_conversion_language = "en_US"; var google_conversion_format = "1"; var google_conversion_color = "CC6600"; if ([B]<?php echo $order_subtotal ?>[/B]) { var google_conversion_value = [B]<?php echo $order_subtotal ?>[/B]; } var google_conversion_label = "purchase"; //--> </script> <script language="JavaScript" src="https://www.googleadservices.com/pagead/conversion.js"> </script> <noscript> <img height=1 width=1 border=0 src="https://www.googleadservices.com/pagead/conversion/<my_conversion_id>/imp.gif?value=[B]<?php echo $order_subtotal ?>[/B]&label=purchase&script=0"> </noscript> <!-- End Google AdWords Conversion Code --> ... ```

I've compared it (using winmerge) against a freshly downloaded snippet from Google, and they are exactly the same. (On Google, I designated https:// from the drop-down, filled in <?php echo $order_subtotal ?> into the field for the value, and refreshed the snippet. That placed the php code for the sub-total field into the correct place in the fresh snippet.)

I tried wrapping the whole thing in a <p> tag or a <div> tag hoping that would force it to show Google's notification image, but no luck. When I run a test order on my test site (not from an AdWords click), the page source view shows me the sub-total value of the order in the proper places, as below (pasted in from source view, except for conversion id):

if (4.9900) {
var google_conversion_value = 4.9900;
}

and again:

<img height=1 width=1 border=0 src="https://www.googleadservices.com/pagead/conversion/<my_conversion_id>/imp.gif?value=[B]4.9900[/B]&label=purchase&script=0">

Any suggestions in my remaining snags? Once again, they are:

  • Have to insert code into template file tpl_checkout_success_default.php, not in its own separate modules/pages/checkout_success/ file.
  • Google's required notification image doesn't appear on screen.
20 Jul 2007, 4:38 PM
#19
econcepts avatar

econcepts

Totally Zenned

Join Date:
Dec 2005
Posts:
1,505
Plugin Contributions:
2

Re: Google Adwords Conversion Tracking code help.

Alan,

Here is my personal recommendation on this. I have installed Google Analytics with Conversion Tracking on a large number of sites.

All work without a flaw, and all were done this way. I posted the answer to it a while ago in the Google Analytics Integration thread.

http://www.zen-cart.com/forum/showthread.php?p=376521&highlight=Conversion+Tracking#post376521

20 Jul 2007, 6:25 PM
#20
alan_powerbrixx avatar

alan_powerbrixx

New Zenner

Join Date:
Jul 2007
Location:
Durham, NC
Posts:
56
Plugin Contributions:
0

Re: Google Adwords Conversion Tracking code help.

Eric,

Thanks for the information. I'm sure that's the right way to have done it, but since we've had our own shoe-horn approach to both Analytics and AdWords conversion working for months, and since the only thing I wanted to quickly do was to pick up the order value in place of the 1.0 that was going back, I'd best leave it pretty much as it is for now.

It does appear that the notification icon has disappeared, which may be related to our recent upgrade from 1.2.6 to 1.3.7. So there's that to figure out before Google gets wise and complains about it. But otherwise, it seems to be working, as long as we start to see the dollar values showing up in AdWords reports pretty soon.

One of these mythical days when there's plenty of time left over, I may see if I can convert to the more "standard" way of doing this. I'm curious also about $zv_onload. I don't know what that is, but it looks like it could have saved me from writing my own SQL call. My <body> tag has the conditional code for it that is mentioned in Cuda's ReadMe file in the Google Analytics download, but when I get to checkout_success, there is no onload parameter in the <body> tag in view source. So without peeling too many more layers off of this onion for now, I'll just live with it.

(If ignorance of $zv_onload is an indicator, someone may also want to direct me to some pretty basic intro material on supporting a Zen Cart site. I've been improvising my way through things oh, these many months, whereas I expect there are some best "Zen" practices that I could stand to brush up on. Yes, I know about the "e-Start Your Web Store" manual. That's something we want to get pretty soon, I think.)

I'm still game for a quick fix for my disappearing notification image, but if folks feel reluctant to look at this improvised code, I can understand. I'll just keep at it on my own.

Many thanks.