Forums / All Other Contributions/Addons / Google Analytics Integration

Google Analytics Integration

Results 1 to 20 of 660
20 Aug 2006, 08:28
#1
a_berezin avatar

a_berezin

Deceased

Join Date:
Aug 2004
Posts:
1,782
Plugin Contributions:
4

Google Analytics Integration

Google Analytics Integration
Very easy install, without changed of any files, admin control.

Description
===========
This module allow you to integrade the advanced e-commerce Analysis provided by the Google service named Google Analytics as described here:
http://www.google.com/analytics/

Affected files
==============
Changed files
-------------
None
New files
---------
/includes/modules/pages/checkout_success/jscript_google_analytics.php
/includes/modules/pages/checkout_success/on_load_google_analytics.js
/includes/templates/YOURTEMPLATE/jscript/jscript_google_analytics.php

Install:
========
0. BACKUP! BACKUP! BACKUP! BACKUP! BACKUP! BACKUP!
1. Unzip and upload all files to your store directory (change YOURTEMPLATE to your template directory);
2. Go to Admin->Tools->Install SQL Patches and install googlefroogle.sql;
3. Go to admin>tools>Google Analytics and setting up your Google Analytics configuration;
4. Go to your Google Analytics Settings -> Edit Settings -> Edit Main Website Profile -> E-Commerce Website : Yes


Download

The comments and wishes are welcomed.
21 Aug 2006, 00:21
#2
woodymon avatar

woodymon

Totally Zenned

Join Date:
Sep 2004
Posts:
2,309
Plugin Contributions:
0

Re: Google Analytics Integration

a_berezin:


Download


Observe many errors when attempting to dowload this mod from
http://zen-cart.spb.ru/freedownload.php?file=zc-contribution/GoogleAnalytics.zip

including

array(11) { ["customers_host_address"]=>  string(14) "67.189.123.212" ["cartID"]=>  string(0) "" ["cart"]=>  object(shoppingcart)(8) { ["observers"]=>  array(0) { } ["contents"]=>  array(0) { } ["total"]=>  int(0) ["weight"]=>  int(0) ["content_type"]=>  bool(false) ["free_shipping_item"]=>  int(0) ["free_shipping_weight"]=>  int(0) ["free_shipping_price"]=>  int(0) } ["navigation"]=>  &object(navigationhistory)(3) { ["observers"]=>  array(0) { } ["path"]=>  array(1) { [0]=>  array(4) { ["page"]=>  string(5) "index" ["mode"]=>  string(6) "NONSSL" ["get"]=>  array(1) { ["file"]=>  string(35) "zc-contribution/GoogleAnalytics.zip" } ["post"]=>  array(0) { } } } ["snapshot"]=>  array(0) { } } ["check_valid"]=>  string(4) "true" ["language"]=>  string(7) "english" ["languages_id"]=>  string(1) "1" ["languages_code"]=>  string(2) "en" ["currency"]=>  string(3) "USD" ["session_counter"]=>  bool(true) ["customers_ip_address"]=>  string(14) "67.189.123.212" }

Warning: Cannot modify header information - headers already sent by (output started at /home/ecoserv/domains/zen-cart.spb.ru/public_html/freedownload.php:13) in /home/ecoserv/domains/zen-cart.spb.ru/public_html/freedownload.php on line 51
21 Aug 2006, 07:55
#3
woodymon avatar

woodymon

Totally Zenned

Join Date:
Sep 2004
Posts:
2,309
Plugin Contributions:
0

Re: Google Analytics Integration

kelvyn:

..already got it covered yesterday :)


You have it covered but I don't get it. ;)

kelvyn:

Right-click and save link as is your friend :)


When I right click and choose save as I get a file named "freedownload.php". What am I suppose to do with that? I'm using Firefox.

kelvyn:

However, I'm having probs with the actual mods, as you can see, so you might want to hold up a day or two...


I get your message but me think the idea that one person having an issue with a new mod should not dissuade others from downloading. Me think the more testers the merrier.
21 Aug 2006, 07:58
#4
woodymon avatar

woodymon

Totally Zenned

Join Date:
Sep 2004
Posts:
2,309
Plugin Contributions:
0

Re: Google Analytics Integration

Woodymon:

When I right click and choose save as I get a file named "freedownload.php". What am I suppose to do with that?


ANSWER: Rename freedownload.php to "whatever.zip".
21 Aug 2006, 08:07
#5
woodymon avatar

woodymon

Totally Zenned

Join Date:
Sep 2004
Posts:
2,309
Plugin Contributions:
0

Re: Google Analytics Integration

BTW I'm still not convinced that allowing a third party to have such detailed access to private statistical information is the best idea. But if you trust Google to host your email and chat services and track your personal search activities, then entrusting the same third party to host your shop stats analysis program is not much of a leap, is it?
21 Aug 2006, 08:58
#6
a_berezin avatar

a_berezin

Deceased

Join Date:
Aug 2004
Posts:
1,782
Plugin Contributions:
4

Re: Google Analytics Integration

kelvyn:

Hmmm, did you MEAN googlefroogle.sql, or googleanalytics.sql ?
This is actually in admin>configuration>Google Analytics

Certainly, you have understood me

kelvyn:

Looking good, but the problem I have is that the top of each page now has
_analytics_url = "https://ssl.google-analytics.com/urchin.js"; } echo ' '; ?>

???? May be you do somehing wrong? jscript_google_analytics.php very small and easy:

[PHP]<?php
/**
* jscript_google_analytics.php
*
* @package zen-cart statistic
* @copyright Copyright 2005-2006 Andrew Berezin
* @license http://www.zen-cart.com/license/2_0.txt GNU Public License V2.0
* @version $Id: jscript_google_analytics.php,v 1.0.0 18.08.2006 19:19 Andrew Berezin [email protected] $
*/
if ($request_type == 'NONSSL') {
$google_analytics_url = "http://www.google-analytics.com/urchin.js";
} else {
$google_analytics_url = "https://ssl.google-analytics.com/urchin.js";
}
echo '<script src="' . $google_analytics_url . '" type="text/javascript">
</script>
<script type="text/javascript">
_uacct = "' . GOOGLE_ANALYTICS_UACCT . '";
urchinTracker();
</script>';
?>[/PHP]

Woodymon:

Observe many errors when attempting to dowload this mod from
http://zen-cart.spb.ru/freedownload.php?file=zc-contribution/GoogleAnalytics.zip

Debugging. Now it's ok.
22 Aug 2006, 16:44
#7
cuda avatar

cuda

Zen Follower

Join Date:
Jul 2006
Posts:
119
Plugin Contributions:
0

Re: Google Analytics Integration

Does this mod include the google code at the top of the page? From what I can see it does. So if google analytics goes down will your site load? Is this not why google suggests to add the code just before the </body> tag?
22 Aug 2006, 18:55
#8
a_berezin avatar

a_berezin

Deceased

Join Date:
Aug 2004
Posts:
1,782
Plugin Contributions:
4

Re: Google Analytics Integration

Yes. You may manually move this code just before the </body> tag.
23 Aug 2006, 13:05
#9
longstockings avatar

longstockings

Zen Follower

Join Date:
Jul 2004
Posts:
198
Plugin Contributions:
0

Re: Google Analytics Integration

I was getting javascript errors after installing this mod but fixed it by changing the code to this

if ($request_type == 'NONSSL') {
$google_analytics_url = "http://www.google-analytics.com/urchin.js";
} else {
$google_analytics_url = "https://ssl.google-analytics.com/urchin.js";
}
echo '<script type="text/javascript" src="' . $google_analytics_url . '"></script>
<script type="text/javascript">
_uacct = "' . GOOGLE_ANALYTICS_UACCT . '";
urchinTracker();
</script>';
?>


in file YOUR_ZEN_FOLDER/includes/templates/YOUR_TEMPLATE/jscript/jscript_google_analytics.php

Small change I know but the script type must go before the src

Not setup an account at Google Analytics yet but fingers crossed this will work fine
23 Aug 2006, 14:06
#10
a_berezin avatar

a_berezin

Deceased

Join Date:
Aug 2004
Posts:
1,782
Plugin Contributions:
4

Re: Google Analytics Integration

longstockings:

I was getting javascript errors after installing this mod
...
Small change I know but the script type must go before the src

I use original Google Analytics code. And no jscript error. What browser you use?
23 Aug 2006, 18:53
#11
longstockings avatar

longstockings

Zen Follower

Join Date:
Jul 2004
Posts:
198
Plugin Contributions:
0

Re: Google Analytics Integration

My bad

Found the problem was with image handler 2 and that image hover thing among others.

Can an admin delete this and the previous 2 posts as I would hate to give the impression that this contribution is in any way a bit crumby.

FYI I use Firefox but had to test the site in IE and had javascript errors all over the place but these have now been resolved


Sorry a_berezin :(
23 Aug 2006, 20:16
#12
a_berezin avatar

a_berezin

Deceased

Join Date:
Aug 2004
Posts:
1,782
Plugin Contributions:
4

Re: Google Analytics Integration

No problem.
If you use Firefox. I recomend you to use it with nice FireBug extention.
24 Aug 2006, 13:02
#13
a_berezin avatar

a_berezin

Deceased

Join Date:
Aug 2004
Posts:
1,782
Plugin Contributions:
4

Re: Google Analytics Integration

1. v 1.0.1 24.08.2006 16:51
1) Support zen-cart 1.2.x
2) Clear code
24 Aug 2006, 20:09
#14
a_berezin avatar

a_berezin

Deceased

Join Date:
Aug 2004
Posts:
1,782
Plugin Contributions:
4

Re: Google Analytics Integration

1.3 and 1.2
29 Aug 2006, 13:04
#15
brent avatar

brent

Totally Zenned

Join Date:
Mar 2005
Posts:
606
Plugin Contributions:
0

Re: Google Analytics Integration

a_berezin:

1.3 and 1.2


Hi Andrew,

I (think :blush: ) I've followed the install instructions but I can't get this to work with 1.2.7d. The Admin menus appear etc. but the code is not entered on each page in my store by the java script.

Quote the JScript Readme
JavaScript Override How-To

Any file in this directory with the following filename format will be loaded globally on every page of your shop:
jscript_{unique_name}.js


Could it be this? As a test I changed jscript_google_analytics.php to jscript_google_analytics.js and the code is then loaded but obviously with errors.

I tried with the default install on my V1.3.0.2 test site and that was fine so I assume there were changes made here between 1.2.x and 1.3.x?

Any help would be appreciated.

Regards

Brent
29 Aug 2006, 14:49
#16
a_berezin avatar

a_berezin

Deceased

Join Date:
Aug 2004
Posts:
1,782
Plugin Contributions:
4

Re: Google Analytics Integration

For 1.2.x insert code from jscript_google_analytics.php to html_header.php
29 Aug 2006, 15:23
#17
a_berezin avatar

a_berezin

Deceased

Join Date:
Aug 2004
Posts:
1,782
Plugin Contributions:
4

Re: Google Analytics Integration

For zen-cart 1.2 you may use this jscript_google_analytics.js:
/**
 * jscript_google_analytics.js
 *
 * @package zen-cart statistic
 * @copyright Copyright 2005-2006 Andrew Berezin
 * @license http://www.zen-cart.com/license/2_0.txt GNU Public License V2.0
 * @version $Id: jscript_google_analytics.js,v 1.0.1 29.08.2006 19:24 Andrew Berezin [email protected] $
 */
  GOOGLE_ANALYTICS_UACCT = 'UA-XXXXXX-X';

  google_analytics_url = "http://www.google-analytics.com/urchin.js";
  if (p = window.location.protocol) {
    if (p == 'https:') 
      google_analytics_url = "https://ssl.google-analytics.com/urchin.js";
  }
  var oTheHead = document.getElementsByTagName("head").item(0);
  var scrUTM = document.createElement("script");
  scrUTM.type = "text/javascript";
  scrUTM.src = google_analytics_url;
  oTheHead.appendChild(scrUTM);
  scrHTML = '';
  scrHTML += "\n_uacct = '"+GOOGLE_ANALYTICS_UACCT+"';\n";
  scrHTML += "urchinTracker();\n";
  var scrUTM = document.createElement("script");
  scrUTM.type = "text/javascript";
  scrUTM.innerHTML = scrHTML;
  oTheHead.appendChild(scrUTM);
29 Aug 2006, 15:26
#18
brent avatar

brent

Totally Zenned

Join Date:
Mar 2005
Posts:
606
Plugin Contributions:
0

Re: Google Analytics Integration

Thanks Andrew. I do have other tracking scripts inserted like this but your stuff is always so slick I overlooked the obvious.
29 Aug 2006, 16:07
#19
brent avatar

brent

Totally Zenned

Join Date:
Mar 2005
Posts:
606
Plugin Contributions:
0

Re: Google Analytics Integration

Thanks, our posts crossed.:smile:

Will try the new code and report back.
31 Aug 2006, 22:53
#20
stephen avatar

stephen

New Zenner

Join Date:
Jul 2006
Posts:
12
Plugin Contributions:
0

Re: Google Analytics Integration

Google Analytics Integration installed and working fine! Thank you!
Now for the details of site tracking.
Do you add the google generated script to every product and page that you want to track, as google suggests? Or is there another way to add their js?

<script src="http://www.google-analytics.com/urchin.js" type="text/javascript">
</script>
<script type="text/javascript">
_uacct = "UA-64XXXX-1";
urchinTracker();
</script>