![]() |
|
| |||||||
| Register | Blogs | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| Zen Cart & osCommerce Tips, advice and help on how to use the most popular free E-commerce shopping carts available. |
![]() |
|
|
LinkBack (2) | Thread Tools | Display Modes |
|
|||
|
First thing you need to do is to open an account with Google, you can do that here http://www.google.com/analytics/
Once you have an account you will be given a snippet of code to install on each page you want tracked. On a normal HTML page you will place this just before the </body> tag at the bottom of each page. You may read on some other sites that should place this at the top of the page, you should ignore such advice because if it's placed at the top of a page and there is a delay in the communication with the Google server then your page won't load load until it's finished, resulting in slow page load times and annoyed customers. If placed at the bottom, then the page will load first and be usable before Google has done it's bit. The code snippet looks something like this HTML Code:
<script src="http://www.google-analytics.com/urchin.js" type="text/javascript"> </script> <script type="text/javascript"> _uacct = "UA-2462717-1"; urchinTracker(); </script> At the bottom of which you will see something like this. PHP Code:
PHP Code:
__________________
Lawrence |
|
|||
|
Hi Lawrence
I look after an OSCOMMERCE site for a client but it would not appear that the file footer.php situated within INCLUDES is supporting my clients site. The footer information I do see seems to be editable in a file titled english.php that has a section contained within it saying define footer text and here I can edit text that I want to appear on every page. However, the actual footer file situated within INCLUDES looks nothing like what you refer too. Appreciate your advice on where I might be going wrong? |
|
|||
|
Hi ICTADVIS
It is possible that your client is running an older version of osCommerce than the one I used in my example so the code will be slightly different. The principle is still the same, place the Analytics code after the last ?> in includes/footer.php. To check it's actual position on a page, open the site in your browser then view the source for the page. It should appear just before the </body> tag.
__________________
Lawrence |
|
|||
|
One problem that you're likely to encounter if you use SSL on the server is that you will get a security error when your browser changes from http to https. To get around this, you use https://ssl.google-analytics.com/urchin.js instead of the normal Google address when in SSL mode. To enable OSC to switch between the two, you delete the urchin call from the example above and insert this snippet immediately before the last ?>
PHP Code:
PHP Code:
__________________
Lawrence |
|
|||
|
Hi Lawrence
Your reply is very much appreciated and I will look towards making these changes in this OScommerce platform of my clients site. This is the only site left operating OScommerce as most of my either clients opted to move over to Zencart when it became available, although it does not go without its challenges also when it comes to programming it with Analytics. Another question for you, if you don't mind is to ask about your preferred code use. Are you sticking with Google's urchin code or have you opted to include their revised code for sites you are now doing? Many thanks again for your original response and in advance should you manage to get time to respond to this thread |
|
|||
|
Hi Lawrence
No financial meltdown affecting our industry then, if both of us are at our desks on a Saturday afternoon, someone must be paying us both ![]() Thanks for the swift response and that just reaffirms we are selecting the right code all the time to paste into sites since Google started to offer it. I better be off now and let my other half know I am alive and well!! Enjoy! |
|
|||
|
Quote:
![]()
__________________
Lawrence |
|
|||
|
Hi,
I added the GA code (new ga.js) version to the end of my footer.php and I can actually verify now on every page when I view source that the code shows just before the </body>, it has my GA ID (basically GA gave me the code pre-typed so I just pasted it as-is) but when I go and browse my website (from 2 locations) and test a few pages and then go to GA the reports still show 0 visitors. Does it take a long time to start seeing visitors logged in GA or should it have been immidiate? I tried from both IE and Firefox (2 different IPs/locations) and still no visitors. Any idea? it has been almost 30 minutes since I plugged the code and still nothing. Thanks, Ix. |
|
||||
|
Am assuming this method will also work if using zencart?
|
|
|||
|
GA doesn't work in real time. They say that it updates every 24hrs, though in practice it updates every 3-4 hrs or so, so you just have to give it some time. I imagine that you've probably worked this out for yourself by now though.
__________________
Lawrence |
|
|||
|
SSL switching is built into the new GA code (OP was written before new GA code was available), so as long as you use that and not the older urchin code, all you will have to do is place the code Google gives you in the template footer.
__________________
Lawrence |
|
|||
|
why not skip all the heartache and install the osCommerce Google Analytics module?
http://www.oscommerce.com/community/.../search,google These modules work great for my osc and zen-cart stores. |
![]() |
| Bookmarks |
| Tags |
| google analytics, oscommerce |
LinkBacks (?)
LinkBack to this Thread: http://www.eshopforums.com/f13/how-add-google-analytics-every-page-your-oscommerce-store-106/
|
|||
| Posted By | For | Type | Date |
| CasBaH's Bookmarks on Delicious | This thread | Refback | 09-10-2008 04:22 PM |
| javascript code in .php footer? | This thread | Refback | 05-10-2007 01:35 AM |
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Google Analytics eCommerce Tracking Module | Lawrence | PHP/HTML/CSS/JavaScript and Servers | 2 | 22-10-2009 10:53 PM |
| Google Analytics Problem.. | Arkwright | Zen Cart & osCommerce | 10 | 14-01-2008 10:01 AM |
| Google Page Rank Update | Lawrence | SEO and PPC | 6 | 31-10-2007 03:08 AM |
| Google is Becoming Wikipedia Without the Talk Page | SEOBook | SEO and PPC | 0 | 08-10-2007 11:10 AM |
| google analytics | Tinkerbell | PHP/HTML/CSS/JavaScript and Servers | 1 | 27-08-2007 04:03 PM |