Zen Cart Logo
Forums / General Questions / Google Ecommerce Tracking

Google Ecommerce Tracking

Views: 36,887

Results 1 to 20 of 108
30 Apr 2015, 8:39 AM
#1
divavocals avatar

divavocals

Totally Zenned

Join Date:
Jan 2007
Location:
Los Angeles, California, United States
Posts:
10,011
Plugin Contributions:
3

Google Ecommerce Tracking

Found multiple posts with no clear answers on this.. Found the code below for adding Google ecommerce tracking in an old post.
Can someone confirm this is correct or guide me to WHERE I might find the right code for Zen Cart to add ecommerce tracking..

<script type="text/javascript">

var _gaq = _gaq || [];
  _gaq.push(['_setAccount', 'UA-xxxxxx-1']);
  _gaq.push(['_trackPageview']);
  _gaq.push(['_addTrans','<?php echo $zv_orders_id ?>','','<?php echo $zv_order_total_cd ?>','<?php echo $zv_order_tax ?>','<?php echo $order_summary['shipping'] ?>','<?php echo $zv_order_city ?>','<?php echo $zv_order_state ?>','<?php echo $zv_order_country ?>']);

  _gaq.push(['_addItem','<?php // Loop through products purchased to track in Google (these come from the "cart_orders_products TABLE)
//sku = "products_model"; productname = "products_name"; category = ""; price = "final_price"; quantity = "products_quantity"
$products_displayed_google = array();
for ($i=0, $n=sizeof($products_array_google); $i<$n; $i++) {
if (!in_array($products_array_google[$i]['id'], $products_displayed_google)) {
echo  $zv_orders_id . '\',
\'' . $products_array_google[$i]['model'] . '\',
\'' . $products_array_google[$i]['text'] . '\',
\'\',
\'' . $products_array_google[$i]['price'] . '\',
\'' . $products_array_google[$i]['quantity'] . '\'
' . ((($i+1)<$n) ? ',\'' : '' ) ;

}
}

?>])
  _gaq.push(['_trackTrans']); //submits transaction to the Analytics servers

  (function() {
    var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
    ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
    var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
  })();
   __utmSetTrans()

</script>
30 Apr 2015, 9:11 AM
#2
design75 avatar

design75

Totally Zenned

Join Date:
Dec 2009
Location:
Amersfoort, The Netherlands
Posts:
2,862
Plugin Contributions:
5

Re: Google Ecommerce Tracking

I think I saw that code in the latest Easy Google Analytics mod

30 Apr 2015, 2:39 PM
#3
divavocals avatar

divavocals

Totally Zenned

Join Date:
Jan 2007
Location:
Los Angeles, California, United States
Posts:
10,011
Plugin Contributions:
3

Re: Google Ecommerce Tracking

Design75:

I think I saw that code in the latest Easy Google Analytics mod
I do know it's there, but I ONLY need/want the Google ecommerce tracking (regular Analytics tracking is handled).. Do you know offhand if there is there a way to activate JUST the Google ecommerce tracking using the Easy Google Analytics module?

30 Apr 2015, 2:48 PM
#4
design75 avatar

design75

Totally Zenned

Join Date:
Dec 2009
Location:
Amersfoort, The Netherlands
Posts:
2,862
Plugin Contributions:
5

Re: Google Ecommerce Tracking

DivaVocals:

I do know it's there, but I ONLY need/want the Google ecommerce tracking (regular Analytics tracking is handled).. Do you know offhand if there is there a way to activate JUST the Google ecommerce tracking using the Easy Google Analytics module?
no sorry i do not. I have not had the chance to use it yet.

30 Apr 2015, 7:52 PM
#5
rodg avatar

rodg

Deceased

Join Date:
Jan 2007
Location:
Australia
Posts:
6,263
Plugin Contributions:
4

Re: Google Ecommerce Tracking

DivaVocals:

I do know it's there, but I ONLY need/want the Google ecommerce tracking (regular Analytics tracking is handled).. Do you know offhand if there is there a way to activate JUST the Google ecommerce tracking using the Easy Google Analytics module?

I'm in the final stages of testing some ec analytics code as we speak (actually, I've been testing and tweaking since just before xmas) and am just about at the stage where it would be good to have another set of eyes check it out.

I have to admit, I've never used the Easy Analytics module and I have no idea if using my module in conjunction with this will cause any conflicts anywhere. My code has been created specifically for the EC tracking, but it also tracks some of the other common 'events' (and all pageviews).

My code doesn't require any changes to any of the zencart files. Just 4 new files to upload (with one of those needing to have the UA-xxxxxxx.x number inserted.

Let me know if you are interested in being a guinea pig. Just one thing to keep in mind - There is no way to 'undo' any data submitted to the Google Analytics, so if something goes amiss (such as the same data being logged twice) you'll be stuck with the results/report.

Cheers
RodG

30 Apr 2015, 10:02 PM
#6
divavocals avatar

divavocals

Totally Zenned

Join Date:
Jan 2007
Location:
Los Angeles, California, United States
Posts:
10,011
Plugin Contributions:
3

Re: Google Ecommerce Tracking

RodG:

I'm in the final stages of testing some ec analytics code as we speak (actually, I've been testing and tweaking since just before xmas) and am just about at the stage where it would be good to have another set of eyes check it out.

I have to admit, I've never used the Easy Analytics module and I have no idea if using my module in conjunction with this will cause any conflicts anywhere. My code has been created specifically for the EC tracking, but it also tracks some of the other common 'events' (and all pageviews).

My code doesn't require any changes to any of the zencart files. Just 4 new files to upload (with one of those needing to have the UA-xxxxxxx.x number inserted.

Let me know if you are interested in being a guinea pig. Just one thing to keep in mind - There is no way to 'undo' any data submitted to the Google Analytics, so if something goes amiss (such as the same data being logged twice) you'll be stuck with the results/report.

Cheers
RodG
Rod I could kiss you!!! YES I'll guinea pig it, and accept the caveat/risk.. (the risk is minor in the scheme of things) I am NOT using any Google Analytics plugin because this site is one of my WordPress/Zen Cart integration sites, and I am using the WordPress Google Analytics plugin to grab those stats for both WordPress and Zen Cart.. The WordPress plugin obviously doesn't support Google Ecommerce Analytics for Zen Cart (there are plugins for WooCommerce, etc). So I only need the Google Ecommerce Analytics for Zen Cart.

30 Apr 2015, 11:47 PM
#7
rodg avatar

rodg

Deceased

Join Date:
Jan 2007
Location:
Australia
Posts:
6,263
Plugin Contributions:
4

Re: Google Ecommerce Tracking

DivaVocals:

YES I'll guinea pig it, and accept the caveat/risk.
<snip>
So I only need the Google Ecommerce Analytics for Zen Cart.

I've just sent you a PM with a link to download.

If anyone else wishes to be a guinea pig please PM me.

Cheers
RodG

ps. This is/will be a free plugin/addon

1 May 2015, 8:47 AM
#8
divavocals avatar

divavocals

Totally Zenned

Join Date:
Jan 2007
Location:
Los Angeles, California, United States
Posts:
10,011
Plugin Contributions:
3

Re: Google Ecommerce Tracking

Installed like a DREAM.. Works like a charm!!! Rod, it's official.. You are my future ex-husband!!!:laugh: (my silly, late night, sleep deprived way of saying you ROCK and thank you!!!)

1 May 2015, 5:20 PM
#9
rodg avatar

rodg

Deceased

Join Date:
Jan 2007
Location:
Australia
Posts:
6,263
Plugin Contributions:
4

Re: Google Ecommerce Tracking

DivaVocals:

Installed like a DREAM.. Works like a charm!!! Rod, it's official.. You are my future ex-husband!!!:laugh: (my silly, late night, sleep deprived way of saying you ROCK and thank you!!!)

Thanks. I'll give you a few days or so to accumulate more data and identify any problems before I upload it here.

Cheers
RodG

1 May 2015, 5:45 PM
#10
divavocals avatar

divavocals

Totally Zenned

Join Date:
Jan 2007
Location:
Los Angeles, California, United States
Posts:
10,011
Plugin Contributions:
3

Re: Google Ecommerce Tracking

RodG:

Thanks. I'll give you a few days or so to accumulate more data and identify any problems before I upload it here.

Cheers
RodG

Sure thing.. will let you know.. Got real data since my 2 test sales.. So far still GREAT!!!

13 May 2015, 1:41 PM
#11
divavocals avatar

divavocals

Totally Zenned

Join Date:
Jan 2007
Location:
Los Angeles, California, United States
Posts:
10,011
Plugin Contributions:
3

Re: Google Ecommerce Tracking

DivaVocals:

Sure thing.. will let you know.. Got real data since my 2 test sales.. So far still GREAT!!!

Update: This thing still works FANTASTIC!!! My client's marketing team is quite pleased.. Getting VERIFIABLE results.. In other words, we can reconcile the data in Google Analytics with sales reports from the store.. You module is correctly picking up our sales activity.. Awesome module Rod!!! I think you need to submit this bad boy!!!

18 May 2015, 7:37 PM
#12
rodg avatar

rodg

Deceased

Join Date:
Jan 2007
Location:
Australia
Posts:
6,263
Plugin Contributions:
4

Re: Google Ecommerce Tracking

DivaVocals:

Update: This thing still works FANTASTIC!!! My client's marketing team is quite pleased.. Getting VERIFIABLE results.. In other words, we can reconcile the data in Google Analytics with sales reports from the store.. You module is correctly picking up our sales activity.. Awesome module Rod!!! I think you need to submit this bad boy!!!

Now available for download here:
https://www.zen-cart.com/downloads.php?do=file&id=1997

Cheers
RodG

19 May 2015, 3:35 PM
#13
divavocals avatar

divavocals

Totally Zenned

Join Date:
Jan 2007
Location:
Los Angeles, California, United States
Posts:
10,011
Plugin Contributions:
3

Re: Google Ecommerce Tracking

RodG:

Now available for download here:
https://www.zen-cart.com/downloads.php?do=file&id=1997

Cheers
RodG
Totally ROCKIN'!!!!

20 May 2015, 5:19 AM
#14
torvista avatar

torvista

Totally Zenned

Join Date:
Aug 2007
Location:
Gijón, Asturias, Spain
Posts:
2,872
Plugin Contributions:
7

Re: Google Ecommerce Tracking

I would add that this plugin is indeed a plugin and not a core file hack, nor any database edits.
It is for Google Enhanced Ecommerce.
I was last week evaluating Simple Google Analytics and Easy Analytics, both unnecessarily complex.
Thankfully this option came up which is by far the most elegant solution. Easy to install, understand and hence maintain/modify to your needs. Look no further!

20 May 2015, 1:58 PM
#15
divavocals avatar

divavocals

Totally Zenned

Join Date:
Jan 2007
Location:
Los Angeles, California, United States
Posts:
10,011
Plugin Contributions:
3

Re: Google Ecommerce Tracking

torvista:

I would add that this plugin is indeed a plugin and not a core file hack, nor any database edits.
It is for Google Enhanced Ecommerce.
I was last week evaluating Simple Google Analytics and Easy Analytics, both unnecessarily complex.
Thankfully this option came up which is by far the most elegant solution. Easy to install, understand and hence maintain/modify to your needs. Look no further!
I agree.. Simple Google Analytics and Easy Analytics are IMHO both unnecessarily complex. It is EASY enough to add the standard Google Analytics code snippet to your site.. All I needed after that was the e-commerce tracking (which was the MOST important thing to my client) This module does this QUICKLY and without any fuss..

20 May 2015, 5:04 PM
#16
rodg avatar

rodg

Deceased

Join Date:
Jan 2007
Location:
Australia
Posts:
6,263
Plugin Contributions:
4

Re: Google Ecommerce Tracking

torvista:

I was last week evaluating Simple Google Analytics and Easy Analytics, both unnecessarily complex.

In "defence" of these modules, to the best of my knowledge they have both been around for many years and the code has evolved and advanced a lot during this time. They'll (probably) continue to support the older Google API's as well as the newer ones.

They probably support many things the EC Analytics doesn't.

Are they complex? Yes. Are they unnecessarily complex? I'm not in a position to judge.

Oh, yeah, they probably also originated before zen-cart added the NOTIFIER system, and that is what has kept the EC Analytics method so simple to install and understand. :-)

I really appreciate the positive comments for EC Analytics though.

Cheers
RodG

31 May 2015, 9:02 AM
#17
nightfly66 avatar

nightfly66

New Zenner

Join Date:
Oct 2008
Posts:
44
Plugin Contributions:
0

Re: Google Ecommerce Tracking

Hi,

i have this myDEBUG file in log: ```php
PHP Fatal error: Class 'ec_analytics' not found in /usr/local/psa/home/vhosts/ ... /autoload_func.php on line 79


i use Zen Cart v 1.5.4

Any suggestion ?

Thx
31 May 2015, 5:23 PM
#18
divavocals avatar

divavocals

Totally Zenned

Join Date:
Jan 2007
Location:
Los Angeles, California, United States
Posts:
10,011
Plugin Contributions:
3

Re: Google Ecommerce Tracking

Nightfly66:

Hi,

i have this myDEBUG file in log: ```php
PHP Fatal error: Class 'ec_analytics' not found in /usr/local/psa/home/vhosts/ ... /autoload_func.php on line 79

> 
> i use Zen Cart v 1.5.4
> 
> Any suggestion ?
> 
> Thx

Double check your installation.. sounds like you missed uploading a file..
31 May 2015, 10:40 PM
#19
rodg avatar

rodg

Deceased

Join Date:
Jan 2007
Location:
Australia
Posts:
6,263
Plugin Contributions:
4

Re: Google Ecommerce Tracking

Nightfly66:

Hi,

i have this myDEBUG file in log: ```php
PHP Fatal error: Class 'ec_analytics' not found in /usr/local/psa/home/vhosts/ ... /autoload_func.php on line 79

> 
> i use Zen Cart v 1.5.4
> 
> Any suggestion ?
> 
> Thx

Not really enough information provided, but as DivaVocals stated, "Double check your installation.. sounds like you missed uploading a file"    (specifically, the /includes/classes/observers/class.ec_analytics.php file)  

Cheers
RodG
4 Sep 2015, 3:30 PM
#20
jeking avatar

jeking

Totally Zenned

Join Date:
Oct 2005
Location:
Chicago, IL USA
Posts:
1,592
Plugin Contributions:
0

Re: Google Ecommerce Tracking

I've installed this on a client using Zen Cart 1.5.2. We're using the universal code in the footer and this plugin for ecommerce. Traffic data is working fine, but no ecommerce data.

Enable Ecommerce and Enable Enhanced Ecommerce Reporting are both on.