ISTATS; Only the unique referer domain name as a stat
  • 2004/11/21 12:32

  • jfebus

  • Just popping in

  • Posts: 97

  • Since: 2004/9/1 1

Hi All,

ISTATS is a great package, but I found the referer report was including all the query string as part of the referer. Another thing it was recording the same domain multiple times due to way the domain was writteN (www.tumaternidad.com <> WWW.TUMATERNIDAD.COM )

To get a unique name of the domain as a stat in ISTATS replace the original code with the following \modules\istats\include\counter.php
 * @feature
 * Keeps track of referers
$referer $HTTP_GET_VARS['referer'];
$referer_array parse_url($referer);
$referer $referer_array['host'];

if (
$referer<>"") {
$referer strtolower("http://".$referer);
} else {
$referer strtolower("http_referer_blocked");


if (!
strstr(strtolower($referer), strtolower(XOOPS_URL))) {
$check_ref getResult("select * from ".XOOPS_DB_PREFIX."_is_referer where ucase(url)='".$referer."'");
    if (
$check_ref) {
mysql_query("update ".XOOPS_DB_PREFIX."_is_referer set count=count+1 where url='".$referer."'");
    } elseif(
$referer != "") {
mysql_query("insert into ".XOOPS_DB_PREFIX."_is_referer values('', '".$referer."', '1')");

This will also log the referals with an empty HTTP_REFERAL (firewall users) and will use the document.rererral value from the script in theme.html.

Please change the script in theme.html to:
<{if $xoops_isadmin != 1}>
script type="text/Javascript">
istat = new Image(1,1);
istat.src "http://WWW.YOUR_WEBSITE.COM/modules/istats/include/counter.php?sw="+screen.width+"&sc="+screen.colorDepth+"&referer="+escape(document.referrer)+"&page="+location.href;

Enjoy it!

Re: ISTATS; Only the unique referer domain name as a stat
  • 2004/11/22 16:27

  • sylvainb

  • Not too shy to talk

  • Posts: 168

  • Since: 2003/2/11

Hello Jfebus

Your modifications/corrections will be tested and then added into Istats.
Thanks for your help into debugging it.
I also want to say that I must apologize for this mistake (document.referer) instead of (document.referrer)... what a shame
Be sure that from know, before applying any modification to a module (modifications that I can see in others threads), I'll test it and test it and test it... and, especially, I'll do a google search with things (javascript) I don't really know.

One more time, thank you and all my appologies to everybody.


Who's Online

107 user(s) are online (44 user(s) are browsing Support Forums)

Members: 0

Guests: 107



Goal: $100.00
Due Date: May 31
Gross Amount: $0.00
Net Balance: $0.00
Left to go: $100.00
Make donations with PayPal!

Latest GitHub Commits