Zen Cart Logo
Forums / General Questions / Google Analytics "google_conversion_value" - what value do I use?

Google Analytics "google_conversion_value" - what value do I use?

Views: 12,215

Results 1 to 20 of 21
10 Aug 2012, 1:40 PM
#1
dunk avatar

dunk

Zen Follower

Join Date:
Dec 2007
Location:
London
Posts:
184
Plugin Contributions:
0

Google Analytics "google_conversion_value" - what value do I use?

We've added some Analytics code to our checkout_success template page to track conversions from our AdWords advertising.
Our marketing agency is trying to find out what the variable is that generates an order's total value in Zen Cart.
They want to insert this variable into the Analytics tracking code so we are able to see the cart value of each conversion.

They did some research and found that the variable is "order_total" but it doesn't seem to be working. Does anyone know what else this variable could be?
It's inserted into the Analytics code as shown below:


<!-- Google Code for Value of order Conversion Page --> <script type="text/javascript"> /* <![CDATA[ */ var google_conversion_id = xxxxxx; var google_conversion_language = "en"; var google_conversion_format = "1"; var google_conversion_color = "ffffff"; var google_conversion_label = "xxxxxx"; var google_conversion_value = **order_total**; /* ]]> */ </script> <script type="text/javascript" src="https://www.googleadservices.com/pagead/conversion.js"> </script> <noscript> <div style="display:inline;"> <img height="1" width="1" style="border-style:none;" alt="" src="https://www.googleadservices.com/pagead/conversion/1032646217/?value=**order_total**&label=xxxxxx&guid=ON&script=0"/> </div> </noscript> -----------------------------------------------------------------------------------------------------------------------------------------------
14 Oct 2012, 8:08 PM
#3
idtags avatar

idtags

Zen Follower

Join Date:
Aug 2005
Posts:
315
Plugin Contributions:
0

Re: Google Analytics "google_conversion_value" - what value do I use?

Do I understand correctly that to use variable Order Final Total I need to copy line <?php echo $order_summary['order_total']; ?> and paste to Google analitics CONVERSOIN VALUE?

Correct syntactic is including < and >. Isn it?

Conversion category
Page security level: HTTP
Markup Language: HTML
Conversion value: ** <?php echo $order_summary['order_total']; ?>**
Tracking indicator ** Google Site Stats privacy notification (English) **
14 Oct 2012, 8:19 PM
#4
idtags avatar

idtags

Zen Follower

Join Date:
Aug 2005
Posts:
315
Plugin Contributions:
0

Re: Google Analytics "google_conversion_value" - what value do I use?

Is it appropriet, also, to add this code, generated by Google analitycs by using Defined Page editor from Tools menu and use suboption
"<> - Toggle HTML code"?

Will it be saved correctly?

Or it should be done only via Notepad++ ?

######################################################################_

<!-- Google Code for Conversion Page --> <script type="text/javascript"> /* <![CDATA[ */ var google_conversion_id = 2063694535; var google_conversion_language = "en"; var google_conversion_format = "1"; var google_conversion_color = "ffffff"; var google_conversion_label = "CF9ZCOiZ8wMTwOGa-wM"; var google_conversion_value = <?php echo $order_summary['order_total']; ?>; /* ]]> */ </script> <script type="text/javascript" src="http://www.googleadservices.com/pagead/conversion.js"> </script> <noscript> <div style="display:inline;"> <img height="1" width="1" style="border-style:none;" alt="" src="http://www.googleadservices.com/pagead/conversion/2063694535/?value=%3C?php%20echo%20$order_summary%5B'order_total'%5D;%20?%3E&label=CF7ZCOiZ5wMQwOGa-wM&guid=ON&script=0"/> </div> </noscript>
20 Oct 2012, 12:19 PM
#5
idtags avatar

idtags

Zen Follower

Join Date:
Aug 2005
Posts:
315
Plugin Contributions:
0

Re: Google Analytics "google_conversion_value" - what value do I use?

Please ignore my previous postins.

All assumptions are incorrect.

I am still searching.

20 Oct 2012, 11:10 PM
#6
drbyte avatar

drbyte

Sensei

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

Re: Google Analytics "google_conversion_value" - what value do I use?

idtags:

Is it appropriet, also, to add this code, generated by Google analitycs by using Defined Page editor from Tools menu and use suboption
"<> - Toggle HTML code"?

Will it be saved correctly?

Or it should be done only via Notepad++ ?
Um ... if "conversion value" is supposed to refer to "the amount of the purchase just completed", then putting your google code into a Define Page is definitely NOT going to be useful. At least, not the way Zen Cart works anyway.

Those $order_summary data pieces are available on the checkout_success page.
Why are you trying to put them onto a Define Page?

21 Oct 2012, 3:23 PM
#7
idtags avatar

idtags

Zen Follower

Join Date:
Aug 2005
Posts:
315
Plugin Contributions:
0

Re: Google Analytics "google_conversion_value" - what value do I use?

DrByte,
Thank you for reply.

Yes, after experimenting with the system it is clear that Define Page editor deals only with textual information.

Google is asking for numerical (currency) variable which represents total value in dollar amount customer paid for product.
I assume that Google code has to be inserted in the file where this variable literary exist to pick it up(?)

Question is what exactly to enter from available suggestions of the forum.

Us, none programmers always have fun to identify right one.

I found following options:

  • $order_summary['order_total']
  • order_total
  • <?php echo $order_total ?>
  • $order_summary

I am not sure what is syntactic, so I will start experiments with <?php echo $order_total ?>

There are also different suggestions for files where to insert Google code:

  • /includes/templates/YOUR_CUSTOM_TEMPLATE_NAME/checkout_success/tpl_footer.php
  • \includes\templates\MY_Custom_Template\common\tpl_main_page.php

I will start with \includes\templates\MY_Custom_Template\common\tpl_main_page.php

If anybody knows what to do for sure and can describe it for none programmers it will be a help.

Otherwise, I will publish suggestions when I will make it working. :smile:

21 Oct 2012, 5:46 PM
#8
drbyte avatar

drbyte

Sensei

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

Re: Google Analytics "google_conversion_value" - what value do I use?

Let's back up to the very beginning: What EXACTLY are you attempting to accomplish here?

There are several discussion threads which already explain how to manually set up Google Analytics code in your store, but if you're looking to do it the easy way, there's a plugin that already takes care of all the details. But it assumes you're wanting analytics based on sales made by buying products in Zen Cart using the normal Zen Cart checkout process.
Your posts make it sound like you're trying to do something outside of normal checkout flow.
And we can't help you if you don't explain what your desired outcome is and what business problem you're trying to solve here.

21 Oct 2012, 11:57 PM
#9
idtags avatar

idtags

Zen Follower

Join Date:
Aug 2005
Posts:
315
Plugin Contributions:
0

Re: Google Analytics "google_conversion_value" - what value do I use?

I am trying to do exactly the same as Dunk described in begining of this Thread.

They were trying to use variable ****order_total and it did not work.

In big picture.
I did signed for Google AdWords and Google analytics at google web site.
To gage effectivness of advertising Google introduced conversion rate parameter.
In order to collect data, they (ask to) inject their code in one of Zen Cart pages which involves in check-out process.
This will be compared with an amount of visitors and statistics will be calculated.

One of steps of this process is generating of Snipped code to inject in to Zen Cart page.
They offer template and ask for number of options and one of them is "What variable is used in Zen Cart which can tell to Google total dollar amoung of purchase". You plug name of this variable in provided template and Google generates code which you copy and paste in the page which has can pass value of total amount to Google system for processing.

This is as far as I can describe this process. My programming ability is below avarage, but I can follow instructions.

So, plan is to use variable: <?php echo $order_total ?>

This generates via Google analitics following code:


<!-- Google Code for Medical Id Bracelets Conversion Page --> <script type="text/javascript"> /* <![CDATA[ */ var google_conversion_id = 222333369; var google_conversion_language = "en"; var google_conversion_format = "1"; var google_conversion_color = "ffffff"; var google_conversion_label = "CF7wweSDSDGMQwOGa-wM"; var google_conversion_value = **<?php echo $order_total ?>;** /* ]]> */ </script> <script type="text/javascript" src="http://www.googleadservices.com/pagead/conversion.js"> </script> <noscript> <div style="display:inline;"> <img height="1" width="1" style="border-style:none;" alt="" src="http://www.googleadservices.com/pagead/conversion/222333369/?value=%3C?php%20echo%20$order_total%20?%3E&label=CF7wweSDSDGMQwOGa-wM&guid=ON&script=0"/> </div> </noscript>

I inserted this code in page **\includes\templates\MY_Custom_Template\common\tpl_main_page.php ** before </body> as Google recommend.

Testing is ahead.

I believe this is a simple process to test market.

I read about a special module "Google analytics" written for Zen Cart.

I think to try it in future.

22 Oct 2012, 12:22 AM
#10
drbyte avatar

drbyte

Sensei

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

Re: Google Analytics "google_conversion_value" - what value do I use?

Google generates javascript for you. It doesn't generate PHP.

So their "?value=%3C?php%20echo%20$order_total%20?%3E&label=..." won't work.

Better approach, since Google's generator isn't smart enough:

  1. Tell google's generator to use $VAR

  2. Then when you get their generated code, replace $VAR with the correct replacement code: **<?php echo $order_summary['order_total']; ?>
    **

  3. And common\tpl_main_page.php is the wrong page, because that will put the code on EVERY page, even the pages that don't handle checkout.
    So, follow the instructions provided at the links I gave earlier, and put it into /includes/templates/YOUR_CUSTOM_TEMPLATE_NAME/checkout_success/tpl_footer.php
    Ref: http://www.zen-cart.com/content.php?299-how-do-i-add-affiliate-tracking-pixels-to-my-site

22 Oct 2012, 2:11 AM
#11
idtags avatar

idtags

Zen Follower

Join Date:
Aug 2005
Posts:
315
Plugin Contributions:
0

Re: Google Analytics "google_conversion_value" - what value do I use?

Thank you.

I think I understood your suggestion.

Will modify my lines, test and report.:smile:

24 Oct 2012, 2:43 AM
#12
idtags avatar

idtags

Zen Follower

Join Date:
Aug 2005
Posts:
315
Plugin Contributions:
0

Re: Google Analytics "google_conversion_value" - what value do I use?

Hello,

1. I generated following code at Google Conversion rate setting page:

<!-- Google Code for Medical Id Bracelets Conversion Page --> <script type="text/javascript"> /* <![CDATA[ */ var google_conversion_id = 222222; var google_conversion_language = "en"; var google_conversion_format = "1"; var google_conversion_color = "ffffff"; var google_conversion_label = "tttttttttttttttt"; var google_conversion_value = **<?php echo $order_summary['order_total']; ?>** /* ]]> */ </script> <script type="text/javascript" src="http://www.googleadservices.com/pagead/conversion.js"> </script> <noscript> <div style="display:inline;"> <img height="1" width="1" style="border-style:none;" alt="" src="http://www.googleadservices.com/pagead/conversion/222222/?**value=<?php echo $order_summary['order_total']; ?>&**amp;label=tttttttttttttttt&guid=ON&script=0"/> </div> </noscript>

2. I placed it here (in the end):
.../includes/templates/your_template/checkout_success/tpl_footer.php

3. I simulated purchase and opened View Source of

http://www.your_domain.com/store/index.php?main_page=checkout_success:

4. There was code in the end of file:

..........................................

</table> <!--bof-navigation display --> <div id="navSuppWrapper"> <div id="navSupp"> <ul> <li><a href="http://www.your_domain.com/store/">Store</a></li> </ul> </div> </div> <!--eof-navigation display --> <!--bof-ip address display --> <!--eof-ip address display --> <!--bof-banner #5 display --> <!--eof-banner #5 display --> <!--bof- site copyright display --> <div id="siteinfoLegal" class="legalCopyright">Copyright © 2012 <a href="http://www.your_domain.com" target="_blank"> </a>- 2015. <a href="http://www.your_domain.com" target="_blank">Idtagsonline.com</a></div> <!--eof- site copyright display --> <script language="JavaScript" type="text/javascript" src="http://www.your_domain.com/affiliates/sale.php?amount=32.99&trans_id=9484"></script></td></tr> </table> ####################################### ## START GOOGLE ANALITYCS CONVERSION ## ####################################### <!-- Google Code for Medical Id Bracelets Conversion Page --> <script type="text/javascript"> /* <![CDATA[ */ var google_conversion_id = 1063694528; var google_conversion_language = "en"; var google_conversion_format = "1"; var google_conversion_color = "ffffff"; var google_conversion_label = "CF7ZCOiZ5wMQwOGa-wM"; **var google_conversion_value = **; /* ]]> */ </script> <script type="text/javascript" src="http://www.googleadservices.com/pagead/conversion.js"> </script> <noscript> <div style="display:inline;"> <img height="1" width="1" style="border-style:none;" alt="" src="http://www.googleadservices.com/pagead/conversion/1063694528/?**value**=&label=CF7ZCOiZ5wMQwOGa-wM&guid=ON&script=0"/> </div> </noscript> ####################################### ## E N D GOOGLE ANALITYCS CONVERSION ## #######################################</div> <!--bof- parse time display --> <!--eof- parse time display --> <!--bof- banner #6 display --> <!--eof- banner #6 display --> </body></html> ################################################################################

Does it look right?

Thank you for looking.

24 Oct 2012, 4:13 AM
#13
drbyte avatar

drbyte

Sensei

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

Re: Google Analytics "google_conversion_value" - what value do I use?

Looks right other than there's no amount there.

What version of Zen Cart are you using?
What mods/addons/plugins do you have installed?
What template are you using?

24 Oct 2012, 12:06 PM
#14
idtags avatar

idtags

Zen Follower

Join Date:
Aug 2005
Posts:
315
Plugin Contributions:
0

Re: Google Analytics "google_conversion_value" - what value do I use?

What version of Zen Cart are you using? 1.3.9

What mods/addons/plugins do you have installed? "Jarox affiliate program (working)", "Monthly report"

What template are you using? "Custom template"

24 Oct 2012, 12:32 PM
#15
idtags avatar

idtags

Zen Follower

Join Date:
Aug 2005
Posts:
315
Plugin Contributions:
0

Re: Google Analytics "google_conversion_value" - what value do I use?

I found older post by Jivananda (http://www.zen-cart.com/showthread.php?52145-Google-Adwords-Conversion-Tracking-code-help)

There is suggestion to use variable <?php echo $order_total ?>;} instead of <?php echo $order_summary['order_total']; ?>

Could it be my problem of not passing value?

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!

24 Oct 2012, 3:09 PM
#16
drbyte avatar

drbyte

Sensei

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

Re: Google Analytics "google_conversion_value" - what value do I use?

You said you're using "v1.3.9". There were 8 editions, a-thru-h. Which one are you using?

If using **$order_summary['order_total'] **isn't working for you, then you've apparently got a very old version of /includes/modules/pages/checkout_success/header_php.php on your server.

So, you can either use the more accurate **$order_summary['order_total'] **, or if you can't get that to work because your code is different than normal Zen Cart code, then go ahead and use what Jivananda posted.

24 Oct 2012, 3:39 PM
#17
idtags avatar

idtags

Zen Follower

Join Date:
Aug 2005
Posts:
315
Plugin Contributions:
0

Re: Google Analytics "google_conversion_value" - what value do I use?

I am sorry, I am worse than this.
My version is older:

Zen Cart 1.3.7.1
Database Patch Level: 1.3.7

I will try both suggestions.

Thank you.

24 Oct 2012, 3:54 PM
#18
gjh42 avatar

gjh42

Black Belt

Join Date:
Jul 2005
Location:
Upstate NY
Posts:
21,876
Plugin Contributions:
8

Re: Google Analytics "google_conversion_value" - what value do I use?

V1.3.7.1? Seriously? You really need to spend your time on upgrading to a newer secure version (v1.3.9h at least, preferably v1.5.1) or you will get hacked sooner or later... and that will take more time to fix than upgrading will take.

25 Oct 2012, 12:13 PM
#19
idtags avatar

idtags

Zen Follower

Join Date:
Aug 2005
Posts:
315
Plugin Contributions:
0

Re: Google Analytics "google_conversion_value" - what value do I use?

Variable <?php echo $order_total ?> did not work.

<!-- Google Code for Medical Id Bracelets Conversion Page --> <script type="text/javascript"> /* <![CDATA[ */ var google_conversion_id = 222222; var google_conversion_language = "en"; var google_conversion_format = "1"; var google_conversion_color = "ffffff"; var google_conversion_label = "tttttttttttttttt"; var google_conversion_value = **<?php echo $order_total ?>** /* ]]> */ </script> <script type="text/javascript" src="http://www.googleadservices.com/pagead/conversion.js"> </script> <noscript> <div style="display:inline;"> <img height="1" width="1" style="border-style:none;" alt="" src="http://www.googleadservices.com/pagead/conversion/222222/?value=**<?php echo $order_total ?>**&label=tttttttttttttttt&guid=ON&script=0"/> </div> </noscript>

There is no error messages, but in in source file (html) there is no any value passing.

26 Oct 2012, 3:55 PM
#20
drbyte avatar

drbyte

Sensei

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

Re: Google Analytics "google_conversion_value" - what value do I use?

Sounds like you skipped the rest of the code you quoted from Jivananda: ```

<?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']; ?>