Navigate to /templates from your root folder. You will see two files in there along with some other folders. Ignore the folders and edit the file that relates to the type of template you are using - table based or default. Add your google tracking code into the file right before the </body> tag. Save your changes and exit the text editor. Job done.
To view that the code is entered correctly go to your index page and view it's source.
Latest News: (loading..)
Adding Google Analytics tracking code to osC
Started by woolef, May 02 2009, 17:00
11 replies to this topic
#1
Posted 02 May 2009, 17:00
#2
Posted 07 February 2010, 19:41
What you mean?
Administration Access Level Accounts 2.0 | Wishlist 2.0 | Supplier Admin Area V0.2 | Pricematch | Terms Acceptance 1.0 | Date of Birth PullDown | Header Tags SEO V 3.0 | Product Extra Fields | Article Manager v1.0 | Supertracker v3.1a | myQBI Quickbooks Sync | ## POINTS AND REWARDS MODULE V1.00 ##
#3
Posted 16 February 2010, 14:52
hi i try to that but first i cant see anu <body> in this code and also i have this Error: I can not write to this file. Please set the right user permissions on: /var/www/vhosts/......./httpdocs//index.php
can you help me about that?thanks
can you help me about that?thanks
#4
Posted 21 February 2010, 05:30
themall, on 16 February 2010, 14:52, said:
hi i try to that but first i cant see anu <body> in this code and also i have this Error: I can not write to this file. Please set the right user permissions on: /var/www/vhosts/......./httpdocs//index.php
can you help me about that?thanks
can you help me about that?thanks
the user permissions i don't know for sure about other than if you have the file permissions set to read only on your server? you should be able to update this via your hosting control panel or your ftp access.
i also going to guess you're looking at the wrong file too. the file you want is located at catalog/templates/default.php (this *could* be different if you changed from the default template, but it is probably not named index.php) this is where your body tag should be
#5
Posted 14 May 2010, 05:49
woolef,
I wish I could follow your instructions. I recommend simply adding your tracking code to your footer file (includes/footer.php). Doing so applies it to every page.
I wish I could follow your instructions. I recommend simply adding your tracking code to your footer file (includes/footer.php). Doing so applies it to every page.
[IMG]http://img263.imageshack.us/img263/4146/plasma.jpg[/IMG]
#6
Posted 28 April 2011, 13:36
Woolef, thanks for the great idea with the footer. Big help
#7
Posted 02 May 2011, 06:38
But...
The tracking code should be added just before the last </head> on the page, according to google. There are no </head>s on the footer, so where should I add the code?
Here's the footer code:
<?php
/*
$Id$
osCommerce, Open Source E-Commerce Solutions
http://www.oscommerce.com
Copyright © 2010 osCommerce
Released under the GNU General Public License
*/
require(DIR_WS_INCLUDES . 'counter.php');
?>
<div class="grid_24 footer">
<p align="center"><?php echo FOOTER_TEXT_BODY; ?></p>
</div>
<?php
if ($banner = tep_banner_exists('dynamic', '468x50')) {
?>
<div class="grid_24" style="text-align: center; padding-bottom: 20px;">
<?php echo tep_display_banner('static', $banner); ?>
</div>
<?php
}
?>
<script type="text/javascript">
$('.productListTable tr:nth-child(even)').addClass('alt');
</script>
Also - why footer, why not header? (still no </head>s, though)
Thanks in advance for any help!
Suvi
The tracking code should be added just before the last </head> on the page, according to google. There are no </head>s on the footer, so where should I add the code?
Here's the footer code:
<?php
/*
$Id$
osCommerce, Open Source E-Commerce Solutions
http://www.oscommerce.com
Copyright © 2010 osCommerce
Released under the GNU General Public License
*/
require(DIR_WS_INCLUDES . 'counter.php');
?>
<div class="grid_24 footer">
<p align="center"><?php echo FOOTER_TEXT_BODY; ?></p>
</div>
<?php
if ($banner = tep_banner_exists('dynamic', '468x50')) {
?>
<div class="grid_24" style="text-align: center; padding-bottom: 20px;">
<?php echo tep_display_banner('static', $banner); ?>
</div>
<?php
}
?>
<script type="text/javascript">
$('.productListTable tr:nth-child(even)').addClass('alt');
</script>
Also - why footer, why not header? (still no </head>s, though)
Thanks in advance for any help!
Suvi
#8
Posted 16 May 2011, 10:58
I would like to thank everyone who helped to write this code. my site has been modified in so many aspects and did not think that "osCommerce Google Analytics module" contribution would work.
I can't believe the questions so many users make.
My advise download and read the read me files and follow the install instructions to the letter.
My site is now after 24 hours returning usfull data to GA.
Thanks Again
thebrit63
I can't believe the questions so many users make.
My advise download and read the read me files and follow the install instructions to the letter.
My site is now after 24 hours returning usfull data to GA.
Thanks Again
thebrit63
#9
Posted 19 September 2011, 10:56
Suvi2208, on 02 May 2011, 06:38, said:
But...
The tracking code should be added just before the last </head> on the page, according to google. There are no </head>s on the footer, so where should I add the code?
Here's the footer code:
<?php
/*
$Id$
osCommerce, Open Source E-Commerce Solutions
http://www.oscommerce.com
Copyright © 2010 osCommerce
Released under the GNU General Public License
*/
require(DIR_WS_INCLUDES . 'counter.php');
?>
<div class="grid_24 footer">
<p align="center"><?php echo FOOTER_TEXT_BODY; ?></p>
</div>
<?php
if ($banner = tep_banner_exists('dynamic', '468x50')) {
?>
<div class="grid_24" style="text-align: center; padding-bottom: 20px;">
<?php echo tep_display_banner('static', $banner); ?>
</div>
<?php
}
?>
<script type="text/javascript">
$('.productListTable tr:nth-child(even)').addClass('alt');
</script>
Also - why footer, why not header? (still no </head>s, though) [img]http://forums.oscommerce.com/public/style_emoticons/default/blush.gif[/img]
Thanks in advance for any help!
Suvi
The tracking code should be added just before the last </head> on the page, according to google. There are no </head>s on the footer, so where should I add the code?
Here's the footer code:
<?php
/*
$Id$
osCommerce, Open Source E-Commerce Solutions
http://www.oscommerce.com
Copyright © 2010 osCommerce
Released under the GNU General Public License
*/
require(DIR_WS_INCLUDES . 'counter.php');
?>
<div class="grid_24 footer">
<p align="center"><?php echo FOOTER_TEXT_BODY; ?></p>
</div>
<?php
if ($banner = tep_banner_exists('dynamic', '468x50')) {
?>
<div class="grid_24" style="text-align: center; padding-bottom: 20px;">
<?php echo tep_display_banner('static', $banner); ?>
</div>
<?php
}
?>
<script type="text/javascript">
$('.productListTable tr:nth-child(even)').addClass('alt');
</script>
Also - why footer, why not header? (still no </head>s, though) [img]http://forums.oscommerce.com/public/style_emoticons/default/blush.gif[/img]
Thanks in advance for any help!
Suvi
Thanks for sharing your view on it. It really helps!
#10
Posted 28 September 2011, 08:39
Hi, I need help. I need google analytics module for oscommerce version 1.03 with orders tracking. If you have some please help. Or if you have any idea how to do it. Great thanks
#11
Posted 09 October 2011, 13:26
Need help installing add ons/contributions, cleaning a hacked site or a bespoke development, check my profile
Virus Threat Scanner
My Contributions
Basic install answers.
Click here for Contributions / Add Ons.
UK your site.
Site Move.
Basic design info.
For links mentioned in old answers that are no longer here follow this link Useful Threads.
If this post was useful, click the Like This button over there ======>>>>>.
Virus Threat Scanner
My Contributions
Basic install answers.
Click here for Contributions / Add Ons.
UK your site.
Site Move.
Basic design info.
For links mentioned in old answers that are no longer here follow this link Useful Threads.
If this post was useful, click the Like This button over there ======>>>>>.
#12
Posted 16 October 2011, 02:00
To make it more accurate, you can exclude your own IP or IP of office so google analytics doesn't track your own visits to website: https://www.google.com/support/googleanalytics/bin/answer.py?answer=55481&hl=en_US&utm_id=ad














