Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Google Analytics problem in footer.php


jamiewiles

Recommended Posts

Hi,

 

When i add the googly analytics code at the bottom of footer.php like this:

 

<td align="center"><?php echo tep_display_banner('static', $banner); ?></td>

</tr>

</table>

<?php

}

 

<!-- Google Analytics Code -->

<?php

if( $_SERVER['HTTPS'] != "on" ){

echo "<script src=\"http://www.google-analytics.com/urchin.js\" type=\"text/javascript\">

</script>

<script type=\"text/javascript\">

_uacct = \"UA-xxxxxx-x";

urchinTracker();

</script>";

}

?>

<!-- End Google Analytics Code -->

 

I lose everything at the bottom of my pages, i.e. copyright stuff and page counter.

Any ideas guys?

Link to comment
Share on other sites

Try this:

 

<?php 
 if ( $_SERVER['HTTPS'] != "on" )  {
?>
<script src="http://www.google-analytics.com/urchin.js" type="text/javascript">
</script>
<script type="text/javascript">
_uacct = "UA-xxxxxx-x";
urchinTracker();
</script>
<!-- End Google Analytics Code -->
<?php 
 }
?>

I think if you investigate further, Google has an updated version of the script that is supposed to work in SSL mode.

If I suggest you edit any file(s) make a backup first - I'm not perfect and neither are you.

 

"Given enough impetus a parallelogramatically shaped projectile can egress a circular orifice."

- Me -

 

"Headers already sent" - The definitive help

 

"Cannot redeclare ..." - How to find/fix it

 

SSL Implementation Help

 

Like this post? "Like" it again over there >

Link to comment
Share on other sites

Try this:

 

<?php 
 if ( $_SERVER['HTTPS'] != "on" )  {
?>
<script src="http://www.google-analytics.com/urchin.js" type="text/javascript">
</script>
<script type="text/javascript">
_uacct = "UA-xxxxxx-x";
urchinTracker();
</script>
<!-- End Google Analytics Code -->
<?php 
 }
?>

I think if you investigate further, Google has an updated version of the script that is supposed to work in SSL mode.

 

Thanks for your help there, but it still doesnt work. (dont think there is a problem with the script actually working) but my pages just lose everything at the bottom. any ideas?

Link to comment
Share on other sites

Thanks for your help there, but it still doesnt work. (dont think there is a problem with the script actually working) but my pages just lose everything at the bottom. any ideas?

 

After a bit of playing i got it to work:

 

<?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');

?>

<table border="0" width="100%" cellspacing="0" cellpadding="1">

<tr class="footer">

<td class="footer">  <?php echo strftime(DATE_FORMAT_LONG); ?>  </td>

<td align="right" class="footer">  <?php echo $counter_now . ' ' . FOOTER_TEXT_REQUESTS_SINCE . ' ' . $counter_startdate_formatted; ?>  </td>

<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-xxxxxxx-1");

pageTracker._initData();

pageTracker._trackPageview();

</script> </tr>

</table>

<br>

<table border="0" width="100%" cellspacing="0" cellpadding="0">

<tr>

<td align="center" class="smallText"><?php echo FOOTER_TEXT_BODY; ?></td>

</tr>

</table>

<?php

if ($banner = tep_banner_exists('dynamic', '468x50')) {

?>

<br>

<table border="0" width="100%" cellspacing="0" cellpadding="0">

<tr>

<td align="center"><?php echo tep_display_banner('static', $banner); ?></td>

</tr>

</table>

<?php

}

 

According to google its working right, but i was told to put the script at the end. will this cause any problems?

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...