Latest News: (loading..)

Archived

This topic is now archived and is closed to further replies.

cyrusfazeli

Google Analytics, where do i paste the code? How do i get it to work for my OSCommerce site

6 posts in this topic

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

Share this post


Link to post
Share on other sites

Cyrus,

 

 

Try this:

 

Google Analytics Contribution

 

 

 

Chris

 

Chris,

Thank you!

Do you know how I run this sql script? And what does this mean: " change the configuration_group_id number to the next available" what do I have to do here?

Thanks again,

Cyrus

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites

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 } ?>

Share this post


Link to post
Share on other sites