Zen Cart Logo
Forums / All Other Contributions/Addons / Simple Google Analytics - Support

Simple Google Analytics - Support

Views: 451,121

Results 481 to 500 of 2,165
4 Jan 2008, 1:17 AM
#481
bahnstoermer avatar

bahnstoermer

New Zenner

Join Date:
Aug 2007
Posts:
94
Plugin Contributions:
0

Simple Google Analytics - Support

Apparently this happens frequently, perhaps the ReadMe should discuss this more clearly? Working on implementing this fix.. :smile:

Are you using a custom template or not? In one error, it references the "template_default" directory, and in the other, it references a "CUSTOM" directory.

If you are using a custom directory, then make sure you put ALL overrides in folders associated with that custom template. So, for example, if you are using a custom template and that directory is called "CUSTOM" (as stated in your error message) then the Google Code needs to be installed in the /includes/templates/CUSTOM/common/tpl_main_page.php file. (Not in the one located within the "template_default" directory.)

Likewise, the directory "google_analytics" should be uploaded to /includes/templates/CUSTOM/google_analytics (NOT /includes/templates/template_default/google_analytics).

Google is unable to verify the code because there is no tracking code present due to the incorrect placement of the files on your end. Once you get them in the correct locations as indicated here, it should all be fine.

You'll need to have Google go back out and check the location of the tracking code to verify it once you have everything in place.

4 Jan 2008, 9:26 AM
#482
ces avatar

ces

Zen Follower

Join Date:
Nov 2004
Location:
West Mids, England
Posts:
199
Plugin Contributions:
0

Re: Simple Google Analytics - Support

Bahnstoermer:

Apparently this happens frequently, perhaps the ReadMe should discuss this more clearly? Working on implementing this fix.. :smile:

Are you using a custom template or not? In one error, it references the "template_default" directory, and in the other, it references a "CUSTOM" directory.

If you are using a custom directory, then make sure you put ALL overrides in folders associated with that custom template. So, for example, if you are using a custom template and that directory is called "CUSTOM" (as stated in your error message) then the Google Code needs to be installed in the /includes/templates/CUSTOM/common/tpl_main_page.php file. (Not in the one located within the "template_default" directory.)

Likewise, the directory "google_analytics" should be uploaded to /includes/templates/CUSTOM/google_analytics (NOT /includes/templates/template_default/google_analytics).

Google is unable to verify the code because there is no tracking code present due to the incorrect placement of the files on your end. Once you get them in the correct locations as indicated here, it should all be fine.

You'll need to have Google go back out and check the location of the tracking code to verify it once you have everything in place.

Hi

It looks like you have found the answer you need.

Basically, for future reference, I browse through all the files when I am working on a new module and whenever I see a folder with:
'custom'
'your_template'
'template_default' etc,
I change the folder name to my template name and use the override.

I also move any files I change in the 'template_default' folder to my override folder, creating one if it does not exist.

Craig

4 Jan 2008, 2:09 PM
#483
econcepts avatar

econcepts

Totally Zenned

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

Re: Simple Google Analytics - Support

jds580s:

Sorry should have included that info in the original post

  1. ZenCart version 1.3.7.1
    Database Patch Level: 1.3.7.1

  2. The only other mod installed is FedEx which was installed at site launch (simple google analytics was installed post launch by about 2 months)
    No other changes happened to the site at the time of the google analytics add-on.

  3. I won't say 100% certain, as there is always room for error, but everything I have reviewed and scrutinized over points to SGA as the culprit. I even asked the host to check error logs and see if there were any updates that might have been responsible for the server behaving differently or modifying the database, they took the time to help but were unable to find anything on their end.

Thanks!

Did you upgrade to the 1.3.7 version from an older version, or was it a fresh install? There are a few lines of SQL code that are included in one of the updates that initiates the infor you are looking for.

Also, this may be a crazy question, but were those elements that seem to be missing there are one time (the fields)? I ask this only because I have seen other carts (Zen versions) even 1.3.7 that even before adding the SGA mod do not include the fields in question here.

In those cases, it would appear as SGA might be the culprit but the fields were not there anyhow.

Let me know the above and we can go from there.

4 Jan 2008, 2:48 PM
#484
econcepts avatar

econcepts

Totally Zenned

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

Re: Simple Google Analytics - Support

Bahnstoermer:

All right, now I've got a real problem..

Warning: main(includes/templates/template_default/google_analytics/google_analytics.php): failed to open stream: No such file or directory in xxx/catalog/includes/templates/custom/common/tpl_main_page.php on line 182

Warning: main(includes/templates/template_default/google_analytics/google_analytics.php): failed to open stream: No such file or directory in xxx/catalog/includes/templates/custom/common/tpl_main_page.php on line 182

Fatal error: main(): Failed opening required 'includes/templates/template_default/google_analytics/google_analytics.php' (include_path='.:/usr/local/lib/php') in xxx/catalog/includes/templates/custom/common/tpl_main_page.php on line 182

> 
> Obviously it says it can't find a file but I need to know how to correct this.  I ran the sql file from the admin, set up the configuration in the admin area with the proper google identification numbers for what, analytics and conversion tracking.
> 
> I go to test the conversion, click an Add from google, go to login to my site to make a "purchase" and I get this problem.  Help?  Thanks!



This error is a direct result of not installing the "google_analytics" directory to the proper location (it contains the file that in included on the page with teh bit of code you put into your "tpl_main_page.php" file.

The location of the directory should be in the following area:
/includes/templates/[YOUR CUSTOM TEMPLATE HERE]/

So, once you upload, your directory structure will look like this:
/includes/templates/[YOUR CUSTOM TEMPLATE HERE]/google_analytics

If you are using the default template, then obviously the path would look like this:
/includes/templates/template_default/google_analytics

Once you get that in the correct location, you'll be fine.
4 Jan 2008, 2:56 PM
#485
econcepts avatar

econcepts

Totally Zenned

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

Re: Simple Google Analytics - Support

Bahnstoermer:

Apparently this happens frequently, perhaps the ReadMe should discuss this more clearly? Working on implementing this fix.. :smile:

There is no "fix" as such needed from a module / coding perspective. The "fix" is to install the files to the proper location and determine if you are using a custom template or not so you know where to install them to. :)

Bahnstoermer:

Are you using a custom template or not? In one error, it references the "template_default" directory, and in the other, it references a "CUSTOM" directory.

The reason it references two different locations is because of how the Zen overrides work. Zen first looks to find out if a custom directory exists. If it does, then it uses the files from that directory to "generate" those pages referenced.

If a custom directory does not exist, then it goes back and uses the "default" directory files.

In this case, it is not the module's fault that is causing different locations to print. Those references are not part of the module itself, but rather, part of zen cart and php. It is normal with all sites.

The reason you get the two different locations being referenced is because the files were not installed to the correct locations in the first place. So, due to that problem, the error report you get on the screen will reference both the conflict of the custom directory you are trying to use (referenced in the "tpl_main_page.php" file) and the included file that SHOULD be present in the same custom location (but is not due to incorrect installation). So, it then looks for the include files under the "default" template directory, can't find them there, and reports that back as well.

Again, this is not module error message. It is a PHP message that you are getting which has its foundation on the Zen overrides system.

4 Jan 2008, 2:57 PM
#486
econcepts avatar

econcepts

Totally Zenned

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

Re: Simple Google Analytics - Support

CES:

Hi

Basically, for future reference, I browse through all the files when I am working on a new module and whenever I see a folder with:
'custom'
'your_template'
'template_default' etc,
I change the folder name to my template name and use the override.

I also move any files I change in the 'template_default' folder to my override folder, creating one if it does not exist.

Craig

Exactly. This is what is explained in the documentation (replace any occurrence of "custom etc..." with your own custom directory IF you are using one. Otherwise, use the default directory.

It helps to understand how the overrides work in Zen to get a feel for whaht is going on here.

4 Jan 2008, 3:02 PM
#487
econcepts avatar

econcepts

Totally Zenned

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

Re: Simple Google Analytics - Support

Bahnstoermer:

All right well I found..

includes/templates/template_default/common/tpl_main_page.php

... should I modify this file and put it in my template directory with the header and footer.php?

You should only modify this file IF you are using a custom template (in which case, you should take the file and copy it to your "custom templates" directory name. This will automatically enable Zen overrides and is the preferred method to keep the integrity of your site if any upgrades to zen are released.

If you are using the default template, you can alter the file and leave where it is.

Here is a link to a help file that explains how to create a custom template using the Zen overrides.
https://www.zen-cart.com/tutorials/index.php?article=142

4 Jan 2008, 10:10 PM
#488
bahnstoermer avatar

bahnstoermer

New Zenner

Join Date:
Aug 2007
Posts:
94
Plugin Contributions:
0

Re: Simple Google Analytics - Support

econcepts:

You should only modify this file IF you are using a custom template (in which case, you should take the file and copy it to your "custom templates" directory name. This will automatically enable Zen overrides and is the preferred method to keep the integrity of your site if any upgrades to zen are released.

If you are using the default template, you can alter the file and leave where it is.

Here is a link to a help file that explains how to create a custom template using the Zen overrides.
https://www.zen-cart.com/tutorials/index.php?article=142

econcepts - thanks for the help. Most of what you posted I figured out one way or another, and I guess I had just forgotten the "your_template" text was symbolic. Also note that the info I put in >> >> was a copy paste from another post I found, not actually me typing specific questions.

I suppose all I meant by the Readme was that it perhaps could be more clearly written - but then, I'm not coder and it takes me a while to get back into all the ZC lingo.

Anyway since you're helping out, can I use the other pages that Google Analytics supports within ZC? (Info page, etc)

I also actually have a simple html home page, can I paste the code Google provides into that html and have it "sync" properly with this ZC module?

6 Jan 2008, 1:12 AM
#489
greenhat avatar

greenhat

Zen Follower

Join Date:
May 2007
Posts:
108
Plugin Contributions:
0

Re: Simple Google Analytics - Support

As of December Google has new tracking code for Analytics. After unsuccessfully trying to find the needed modification for this plugin, I figured out the change myself. It's really not that big of a change and not a big deal at all, but to save some time, here's are the code modifications:

includes\templates\your_template\google_analytics\google_analytics.php
at the very beginning of the code

if ($request_type == 'NONSSL') {
// $google_analytics_url = "http://www.google-analytics.com/urchin.js";
$google_analytics_url = "http://www.google-analytics.com/ga.js";

$google_conversion_url = "http://www.googleadservices.com/pagead/conversion.js";
$google_conversion_image_url = "http://www.googleadservices.com/pagead/conversion/";
} else {
// $google_analytics_url = "https://ssl.google-analytics.com/urchin.js";
$google_analytics_url = "https://ssl.google-analytics.com/urchin.js";
$google_conversion_url = "https://www.googleadservices.com/pagead/conversion.js";
$google_conversion_image_url = "https://www.googleadservices.com/pagead/conversion/";
}

echo '<script src="' . $google_analytics_url . '" type="text/javascript">
</script>

<script type="text/javascript"> var pageTracker = _gat._getTracker("' . GOOGLE_ANALYTICS_UACCT . '"); pageTracker._initData(); pageTracker._trackPageview(); </script>';

// echo '<script src="' . $google_analytics_url . '" type="text/javascript">
// </script>
// <script type="text/javascript">
// _uacct = "' . GOOGLE_ANALYTICS_UACCT . '";
// urchinTracker();
// </script>';


6 Jan 2008, 3:48 PM
#490
econcepts avatar

econcepts

Totally Zenned

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

Re: Simple Google Analytics - Support

Bahnstoermer:

econcepts - thanks for the help. Most of what you posted I figured out one way or another, and I guess I had just forgotten the "your_template" text was symbolic. Also note that the info I put in >> >> was a copy paste from another post I found, not actually me typing specific questions.

I suppose all I meant by the Readme was that it perhaps could be more clearly written - but then, I'm not coder and it takes me a while to get back into all the ZC lingo.

Anyway since you're helping out, can I use the other pages that Google Analytics supports within ZC? (Info page, etc)

I also actually have a simple html home page, can I paste the code Google provides into that html and have it "sync" properly with this ZC module?

As long as you installed the module as per the instructions (in the template_main_page.php file) then it should appear on any other page that uses that file (including info pages etc..).

As for the HTML page, you would need to copy and paste the tracking code found at the bottom of one of your pages to the HTML page in order for it to be included in the tracking results. The easiest way to do this is to do a "view source" on one of the pages on your site that has the GA code installed. (this is dome from within your browser).

Then, simply copy and paste the GA code found near the bottom of the page into the HTML page you wish. As long as long as you copy it all correctly, it should work fine. :)

6 Jan 2008, 3:49 PM
#491
econcepts avatar

econcepts

Totally Zenned

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

Re: Simple Google Analytics - Support

greenhat:

As of December Google has new tracking code for Analytics. After unsuccessfully trying to find the needed modification for this plugin, I figured out the change myself. It's really not that big of a change and not a big deal at all, but to save some time, here's are the code modifications:

includes\templates\your_template\google_analytics\google_analytics.php
at the very beginning of the code

if ($request_type == 'NONSSL') {
// $google_analytics_url = "http://www.google-analytics.com/urchin.js";
$google_analytics_url = "http://www.google-analytics.com/ga.js";

$google_conversion_url = "http://www.googleadservices.com/pagead/conversion.js";
$google_conversion_image_url = "http://www.googleadservices.com/pagead/conversion/";
} else {
// $google_analytics_url = "https://ssl.google-analytics.com/urchin.js";
$google_analytics_url = "https://ssl.google-analytics.com/urchin.js";
$google_conversion_url = "https://www.googleadservices.com/pagead/conversion.js";
$google_conversion_image_url = "https://www.googleadservices.com/pagead/conversion/";
}

echo '<script src="' . $google_analytics_url . '" type="text/javascript">
</script>

<script type="text/javascript"> var pageTracker = _gat._getTracker("' . GOOGLE_ANALYTICS_UACCT . '"); pageTracker._initData(); pageTracker._trackPageview(); </script>';

// echo '<script src="' . $google_analytics_url . '" type="text/javascript">
// </script>
// <script type="text/javascript">
// _uacct = "' . GOOGLE_ANALYTICS_UACCT . '";
// urchinTracker();
// </script>';


Yes, this is correct. As stated in a previous post, the current module is being update to include the new code (the "ga" version). The release of that is anticipate within the next 2 days.

6 Jan 2008, 6:31 PM
#492
crabdance avatar

crabdance

Zen Follower

Join Date:
Sep 2007
Posts:
318
Plugin Contributions:
0

Re: Simple Google Analytics - Support

Hello,

I am trying to install he google mod too. I've upgraded all my files in the zip file and I have run the query on the database (new installation not upgrade). Well now that I have done all of that, I don't see the goodle mod in the Admin->Configuration section.

Can someone please nudge in the right direction.

thanks a lot

7 Jan 2008, 4:04 AM
#493
crabdance avatar

crabdance

Zen Follower

Join Date:
Sep 2007
Posts:
318
Plugin Contributions:
0

Re: Simple Google Analytics - Support

Update: I now have the database working and I see the Google settings under Admin->configuration->google.

Problem I have now is that when I try to test the mod on Google it says:
Profile Name: tranquillas.com/biz
Website URL: http://www.tranquillas.com/biz

Tracking Unknown (Last checked: 2008-01-06 7:50 PM PST.)
The Google Analytics tracking code has not been detected on your website's home page. For Analytics to function, you or your web administrator must add the code to each page of your website.

Here is the code that I have at the bottom of my "tpl_main_page.php" file:

<?php if (file_exists($template->get_template_dir('.php',DIR_WS_TEMPLATE, $current_page_base,'google_analytics') . '/google_analytics.php')) { require($template->get_template_dir('.php',DIR_WS_TEMPLATE, $current_page_base,'google_analytics') . '/google_analytics.php'); } ?> <?php require($template->get_template_dir('.php',DIR_WS_TEMPLATE, $current_page_base,'google_analytics') . '/google_analytics.php'); ?> <script type="text/javascript"> var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www."); document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E")); </script> <script type="text/javascript"> var pageTracker = _gat._getTracker("UA-3347195-1"); pageTracker._initData(); pageTracker._trackPageview(); </script>

Can anyone shed some light on why the google check status does not work? I appreciate any help!

7 Jan 2008, 4:44 AM
#494
crabdance avatar

crabdance

Zen Follower

Join Date:
Sep 2007
Posts:
318
Plugin Contributions:
0

Re: Simple Google Analytics - Support

forgot.... I also have the script code at the end of my /home/index.php file.

hope that helps some.

7 Jan 2008, 6:51 AM
#495
rgshearer avatar

rgshearer

New Zenner

Join Date:
Jan 2008
Location:
Lebanon TN
Posts:
10
Plugin Contributions:
0

Re: Simple Google Analytics - Support

I'm having the same problem mentioned earlier when I try to apply the SQL Patch. I get the dreaded 1064 error:

Do you want to turn on Google AdWords Conversion Tracking?
', @t4, 5, NOW(), NOW(), NULL, 'zen_cfg_select_option(array('Yes', 'No'), ');
1064 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'Yes', 'No'), ')' at line 1
in:

I'm using the "future_zen" template and I've tried installing the google_analytics subdir under both the future_zen directory and the template_default directory.

No joy. Analytics is at least partially installed, as it is an option under configuration and google confirms that its working. This LOOKS like its a syntax error in the sql patch... not a problem with a file location...

HELP!

-Rob Shearer

7 Jan 2008, 7:10 AM
#496
rgshearer avatar

rgshearer

New Zenner

Join Date:
Jan 2008
Location:
Lebanon TN
Posts:
10
Plugin Contributions:
0

Re: Simple Google Analytics - Support

Oddly enough, when I opened up the .sql file in notepad and copied and pasted the text into the "query to be executed" box, it ran fine... and installed all the new stuff.

Weird.

uploading the file from my local hard drive failed with the 1064 msg. Copying the SAME text from the .sql file into the box ran without error.

[scratching head...]

Whatever, now its working.

  • rob shearer
7 Jan 2008, 9:53 AM
#497
crabdance avatar

crabdance

Zen Follower

Join Date:
Sep 2007
Posts:
318
Plugin Contributions:
0

Re: Simple Google Analytics - Support

rgshearer:

Oddly enough, when I opened up the .sql file in notepad and copied and pasted the text into the "query to be executed" box, it ran fine... and installed all the new stuff.

Weird.

uploading the file from my local hard drive failed with the 1064 msg. Copying the SAME text from the .sql file into the box ran without error.

[scratching head...]

Whatever, now its working.

  • rob shearer

Hi Rob,

Sorry to hear that you are having issues too! At least you have things to the point where google says it's working. I can't even make it to that point yet. I'm going to go back over the many posts and see if I can find something that will make my code work. Wish me luck. :cool:

p.s. glad that you got it working!

7 Jan 2008, 10:43 AM
#498
crabdance avatar

crabdance

Zen Follower

Join Date:
Sep 2007
Posts:
318
Plugin Contributions:
0

Re: Simple Google Analytics - Support

econcepts:

The tracking code must be on every page for it to work (in the case of Google Analytics). In the case of "conversion" tracking type codes (usually only appear on the "thank you" page), I check to find out what page is being called by the script (checkout_success) and if it is an order confirmation, I include that line of code onto the page.

I only use the tpl_main_page template so as to keep everything under "one roof". It's much easier to manage that way (I run numerous tracking scripts and affiliate programs that need to track sales). The other option is to include the code in the "footer" template. I use to do that, but found it works better for me (management wise) leaving it in only one file.

Here is a link to an older post on the way I do it.

http://www.zen-cart.com/forum/showpost.php?p=377754&postcount=255

Hi there! Just wanted to say thank you for the code that finally got the google stuff to work. Now when you go to the google site it says "Receiving Data". I don't see any information in any reports but from what I can gather from the posts here is that it takes a little time for things to start showing up.

I've been going crazy! Thanks a bunch!

7 Jan 2008, 12:47 PM
#499
econcepts avatar

econcepts

Totally Zenned

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

Re: Simple Google Analytics - Support

crabdance:

forgot.... I also have the script code at the end of my /home/index.php file.

hope that helps some.

After looking at your pages, you have both the "urchin" and the new "ga" version of Google analytics code present. You can only have one (both may not be present).

Try removing one of them and then make sure you give Google the proper url (with the trailing slash) to find and verify the code at.

7 Jan 2008, 12:49 PM
#500
econcepts avatar

econcepts

Totally Zenned

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

Re: Simple Google Analytics - Support

rgshearer:

Oddly enough, when I opened up the .sql file in notepad and copied and pasted the text into the "query to be executed" box, it ran fine... and installed all the new stuff.

Weird.

uploading the file from my local hard drive failed with the 1064 msg. Copying the SAME text from the .sql file into the box ran without error.

[scratching head...]

Whatever, now its working.

  • rob shearer

As you'll see by reading the forums, the best way to apply patches is to copy and paste the code into the Admin and run it that way (as you have done). The upload function doesn't always operate reliably.

Glad you got it working. :)