Hello,
I am an OSCommerce rookie, working on a site for an ECommerce class for my graduate program. I opened up a Google analytics account and did two things that still have not allowed Google Analytics to work:
Created a .php file with the code and FTP'd to my server under Index - didnt work
added the Google Analytics code to a few of the .php files as directed by Google- did not work
Thank you,
Cyrus
Latest News: (loading..)
Google Analytics, where do i paste the code? How do i get it to work for my OSCommerce site
Started by cyrusfazeli, Oct 03 2010 05:41 AM
5 replies to this topic
#1
Posted 03 October 2010 - 05:41 AM
#2
Posted 03 October 2010 - 05:47 AM
#3
#4
Posted 03 October 2010 - 08:44 AM
Cyrus,
Use phpmyadmin in your hosting account cpanel to run the SQL.
ONLY CHANGE the group id if you already have a table with the default ID in use. In most cases, this won't be necessary.
Chris
Use phpmyadmin in your hosting account cpanel to run the SQL.
ONLY CHANGE the group id if you already have a table with the default ID in use. In most cases, this won't be necessary.
Chris
#5
Posted 03 October 2010 - 06:34 PM
i have added my analytics script to the footer.php at the bottom and have never had a problem with it and no need to install a contrib. it will take google a day to pick it up and gather visitor information.
#6
Posted 01 December 2010 - 11:37 AM
Hi,
I'm a newbie to OSCOMMERCE and read a couple of threads on how to add the Google Analytics snippet to OSCOMMERCE in order to get the Analytics. I run OSC V2.2 RC2 and I followed BOWEN's way by adding to Google Analytics snippet of code <script>....</script> to the footer.php file in the includes file (/includes/footer.php) but I also had to change the file permissions to 777 from 555 in order for the footer.php file to be edited. See below the where I entered my snippet of Google code into my footer.php file. Please note after adding the code I set the file permission back to 555. To my delight the Google Analytics is working. To be honest I have to keep and eye on it because I only entered the code in last night but so far so good. I would like to Thank Bowen for his information and if any experts feel that I have done this incorrectly then let me know, as I said I'm a Newbie and just getting my head around this great piece of software
<?php
/*
$Id: footer.php,v 1.26 2003/02/10 22:30:54 hpdl Exp $
osCommerce, Open Source E-Commerce Solutions
http://www.oscommerce.com
Copyright © 2003 osCommerce
Released under the GNU General Public License
*/
require(DIR_WS_INCLUDES . 'counter.php');
?>
<script type="text/javascript">
var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-18468034-4']);
_gaq.push(['_trackPageview']);
(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);
})();
</script>
</td>
<td><?php echo tep_draw_separator('spacer.gif', '5', '1'); ?></td>
</tr>
</table></td>
</tr>
<tr>
<td class="footer">
<table cellpadding="0" cellspacing="0" border="0">
<tr>
<td style="padding:10px 20px 0 0;"><?php echo tep_image(DIR_WS_IMAGES.'p1.gif')?></td>
<td class="ft_line_y"><?php echo tep_draw_separator('spacer.gif', '38', '1'); ?></td>
<td style="width:100%;"><span><a href="<?php echo tep_href_link('specials.php')?>"><?php echo BOX_HEADING_SPECIALS?></a> <a href="<?php echo tep_href_link('advanced_search.php')?>"><?php echo BOX_SEARCH_ADVANCED_SEARCH?></a> <a href="<?php echo tep_href_link('reviews.php')?>"><?php echo BOX_HEADING_REVIEWS?></a>
<?php if (tep_session_is_registered('customer_id')) { ?>
<a href="<?php echo tep_href_link('account.php')?>"><?php echo HEADER_TITLE_MY_ACCOUNT?></a>
<?php } else { ?>
<a href="<?php echo tep_href_link('create_account.php')?>"><?php echo HEADER_TITLE_CREATE_ACCOUNT?></a>
<?php } ?>
I'm a newbie to OSCOMMERCE and read a couple of threads on how to add the Google Analytics snippet to OSCOMMERCE in order to get the Analytics. I run OSC V2.2 RC2 and I followed BOWEN's way by adding to Google Analytics snippet of code <script>....</script> to the footer.php file in the includes file (/includes/footer.php) but I also had to change the file permissions to 777 from 555 in order for the footer.php file to be edited. See below the where I entered my snippet of Google code into my footer.php file. Please note after adding the code I set the file permission back to 555. To my delight the Google Analytics is working. To be honest I have to keep and eye on it because I only entered the code in last night but so far so good. I would like to Thank Bowen for his information and if any experts feel that I have done this incorrectly then let me know, as I said I'm a Newbie and just getting my head around this great piece of software
<?php
/*
$Id: footer.php,v 1.26 2003/02/10 22:30:54 hpdl Exp $
osCommerce, Open Source E-Commerce Solutions
http://www.oscommerce.com
Copyright © 2003 osCommerce
Released under the GNU General Public License
*/
require(DIR_WS_INCLUDES . 'counter.php');
?>
<script type="text/javascript">
var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-18468034-4']);
_gaq.push(['_trackPageview']);
(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);
})();
</script>
</td>
<td><?php echo tep_draw_separator('spacer.gif', '5', '1'); ?></td>
</tr>
</table></td>
</tr>
<tr>
<td class="footer">
<table cellpadding="0" cellspacing="0" border="0">
<tr>
<td style="padding:10px 20px 0 0;"><?php echo tep_image(DIR_WS_IMAGES.'p1.gif')?></td>
<td class="ft_line_y"><?php echo tep_draw_separator('spacer.gif', '38', '1'); ?></td>
<td style="width:100%;"><span><a href="<?php echo tep_href_link('specials.php')?>"><?php echo BOX_HEADING_SPECIALS?></a> <a href="<?php echo tep_href_link('advanced_search.php')?>"><?php echo BOX_SEARCH_ADVANCED_SEARCH?></a> <a href="<?php echo tep_href_link('reviews.php')?>"><?php echo BOX_HEADING_REVIEWS?></a>
<?php if (tep_session_is_registered('customer_id')) { ?>
<a href="<?php echo tep_href_link('account.php')?>"><?php echo HEADER_TITLE_MY_ACCOUNT?></a>
<?php } else { ?>
<a href="<?php echo tep_href_link('create_account.php')?>"><?php echo HEADER_TITLE_CREATE_ACCOUNT?></a>
<?php } ?>










