PDA

View Full Version : OR Site Statisctics MOD



the_sandking
10-27-2003, 08:33 PM
This is a simple MOD that if installed per the instructions, will track all the visitor statistics for your OR user pages. Other pages can be configured to be tracked as well.

Coded specifically for OR

Easy to setup, no extra libraries, or 3rd party code required.

Stores all data in the DB, and creates the necessary table the first time a visitor "hits" a tracked page.

Also tracks GOOGLE bots separately so you can tell if/when your site is being spidered for search engine ranking.

mroyusa
06-08-2004, 09:07 PM
viewing them on my user_bottom.html is anotyher story nothing is showing up. I have had several people go to the site to see if it would appear but nothing this is the code i added into my user_bottom.html

<?php
//Statistics for HTML section of page
require($config[basepath] . "/include/stat_func.inc");
logstats();
?>

the_sandking
06-08-2004, 11:28 PM
viewing them on my user_bottom.html is anotyher story nothing is showing up. I have had several people go to the site to see if it would appear but nothing this is the code i added into my user_bottom.html

<?php
//Statistics for HTML section of page
require($config[basepath] . "/include/stat_func.inc");
logstats();
?>


Could you be a little more specific? What isn't showing-up?

RealEstate
06-08-2004, 11:48 PM
hey sandking,

do you have a demo site where we can see the statistics working?

do only admin have access to see these stats?

RealtyOne
06-09-2004, 12:30 AM
viewing them on my user_bottom.html is anotyher story nothing is showing up. I have had several people go to the site to see if it would appear but nothing this is the code i added into my user_bottom.html

<?php
//Statistics for HTML section of page
require($config[basepath] . "/include/stat_func.inc");
logstats();
?>

From memory there is nothing to show up useing standard code. What you have above is the include and the function trigger but nothing that would be able to be read by visitors.
I did at some stage make a little extra for showing a counter based on this mod but i no longer have it. Its not hard though :)

mroyusa
06-09-2004, 12:35 AM
I thought it was stats that people could see like users online,counter,etc. It is just stats for admin i guess Well then it works fine. :-)

Got a new problem with MOD DOWNLOADS says i need editor. cant6 find it. i did install the wysiwyg editor but i dont think its the right one.

the_sandking
06-09-2004, 08:17 AM
hey sandking,

do you have a demo site where we can see the statistics working?

do only admin have access to see these stats?

Yes, the stats are only viewable via /admin/stats

You will need to create a link on the /admin menu, or visit the URL directly, e.g.

http://www.yoursite.com/admin/stats

RealEstate
06-09-2004, 01:07 PM
taking sandkings stats a bit further....

how about allowing each agent to see the stats for their listings.
ex. im the agent.
- i log in to my account
- i click on my listing #440
- i have an option to see the stats for that listing
----stats can be how many times my listing has been seen
-------today
-------this week
-------last week
-------this month
-------last month
-------from dd/mm/yy to dd/mm/yy (they use a little calendar to select the from and to date.

the results can be given as a numbered bar graphs.
what you guys think?

Liberator
06-14-2004, 08:54 AM
This is a simple MOD that if installed per the instructions, will track all the visitor statistics for your OR user pages. Other pages can be configured to be tracked as well.

Coded specifically for OR

Easy to setup, no extra libraries, or 3rd party code required.

Stores all data in the DB, and creates the necessary table the first time a visitor "hits" a tracked page.

Also tracks GOOGLE bots separately so you can tell if/when your site is being spidered for search engine ranking.

Thanks for a great MOD, but I am having some problems with the way the stats are presented, in particular the 'referer' stats.

In the 'Top Referrers' section, I now have a line for each of my hits (currently 526). Lines 1 to 526 are identical (except for the number) and contain;

141 26.81% direct hit

Line 527 (the last line) contains;

281 53.42% local referrer

This last line is the only line that will drop down to reveal refers and obviously only shows local URL's.

If I check the stats table I can see the correct referers there, including for example 23 from Google.....

Soon this page is going to be so big that it will be too slow to load.

Any ideas?

One more thing... Identical pages for my site (and lots of others) can be requested as http://mysite.com/anypage.php or http://www.mysite.com/anypage. Would it be possible to 'trim out' the www part so each page only shows once?

the_sandking
06-17-2004, 09:36 AM
Thanks for a great MOD, but I am having some problems with the way the stats are presented, in particular the 'referer' stats.

In the 'Top Referrers' section, I now have a line for each of my hits (currently 526). Lines 1 to 526 are identical (except for the number) and contain;

141 26.81% direct hit

Line 527 (the last line) contains;

281 53.42% local referrer

This last line is the only line that will drop down to reveal refers and obviously only shows local URL's.

If I check the stats table I can see the correct referers there, including for example 23 from Google.....

Soon this page is going to be so big that it will be too slow to load.

Any ideas?

One more thing... Identical pages for my site (and lots of others) can be requested as http://mysite.com/anypage.php or http://www.mysite.com/anypage. Would it be possible to 'trim out' the www part so each page only shows once?


If you can, please be more specific regarding what problem you are having. I have many, many, ideas but most of them probably do not apply to your problem.

This is a lightweight stats package, and the data is not really meant for long-term retention, or a really busy site.

I'm sure that you could "trim-out" any text you wish from the logs (i.e. "www") with some sort of REGEX expression. If you are unfamiliar with REGEX (regular expressions) do a google search, it is powerful stuff. As to where in the script to go about doing this, I haven't looked at the script since I released it, so I do not know where to point you specifically.

RealEstate
06-17-2004, 05:20 PM
taking sandkings stats a bit further....

how about allowing each agent to see the stats for their listings.
ex. im the agent.
- i log in to my account
- i click on my listing #440
- i have an option to see the stats for that listing
----stats can be how many times my listing has been seen
-------today
-------this week
-------last week
-------this month
-------last month
-------from dd/mm/yy to dd/mm/yy (they use a little calendar to select the from and to date.

the results can be given as a numbered bar graphs.
what you guys think?

RealEstate
06-30-2004, 03:52 PM
would this be possible for 2.0?

taking sandkings stats a bit further....

how about allowing each agent to see the stats for their listings.
ex. im the agent.
- i log in to my account
- i click on my listing #440
- i have an option to see the stats for that listing
----stats can be how many times my listing has been seen
-------today
-------this week
-------last week
-------this month
-------last month
-------from dd/mm/yy to dd/mm/yy (they use a little calendar to select the from and to date.

the results can be given as a numbered bar graphs.
what you guys think?

i've seen something like this for oscommerce - if that helps.

Liberator
07-04-2004, 03:14 AM
I still can't get stats working properly, so I decided to have a close look. I found it easier to work with AudiStat v1.3 (on which this is based) and decided to add some features like;

Separate stats for;

'Most popular listings'
'Most popular Add to favorites'

Also, I added 'www' to any request for http://mysite.com so that pages don't get listed twice.

Read the readme.txt for instructions.

erenger
07-08-2004, 01:45 AM
Wow,

I installed this mod last night and I'm very impressed, its much better than what I've ever seen so far.

One thing I'm missing is the option to see what screen resolution a viewer is on. Is it possible to add something like that? That way I can keep track of the number of visitors who have 800x600. My site is designed for 1024x768 since I think most boat owners will be able to afford a large monitor, but I want to make sure I'm not wrong.

I hope this is possible.

Cheers,
Eduard

asitudela
07-20-2004, 08:15 PM
HI!!

I used the script of Liberator

My error: Can't select the database jh: $!

¿?

After error i created the table manually





--------------------- En castellano------------------

My error: Can't select the database jh: $!

Alguien conoce ese error.

Después del error como no me creaba la tabla me la he creado yo manualmente

Liberator
07-21-2004, 11:03 AM
HI!!

I used the script of Liberator

My error: Can't select the database jh: $!

¿?

After error i created the table manually





--------------------- En castellano------------------

My error: Can't select the database jh: $!

Alguien conoce ese error.

Después del error como no me creaba la tabla me la he creado yo manualmente


Sorry - please just delete line 16 in stats.php ($sql_dbase = jh;) - it is not needed. I will post a new version shortly with the addition of visitors screen resolution and the number of first time visitors. This needs to use javascript and a cookie but I think it is a useful addition to the stats.

asitudela
07-21-2004, 11:16 AM
I wait fot the new version.

Liberator
08-05-2004, 01:32 AM
Here's a new version of the Stats package;

* Added screen resolution recording
* Added recording of number of previous visits to enable 'First time visits' and 'Return visits' to be tracked
* Added proper country reporting using the geoip library and database (sorry - more disk space needed!)
* Added pretty flags to display of country stats
* A few other minor mods

This new version needs to set a cookie in order to collect the screen resolution and visits information (you can't get this information otherwise).

Please read the readme.txt file and particularly the warning about the size of the stats table. The old stats data will not work properly with this version although it will still provide SOME information from it.

Please make sure you back everything up before editing files - this has only had limited testing.

Any problems then post here or PM me.

--
6th August 2004
Note: I have added an index on remotehost(32), time_str and uploaded a new zip file which will create it on first use. With large database files this gives a significant increase in speed. If you have already installed and run the files, just use phpMyAdmin or whatever to create a (single) index on 2 columns as follows;
Index name = remotetime_str
Field = remote_host Size = 32
Field = time_str Size = (leave empty)

This won't help too much if you have large numbers of hosts to look up because you have many new visitors since the last update - you just have to be patient...

Ron Miller
09-27-2004, 03:31 AM
I have install the MOD Stats following the instruction, but every time I get this error. Can you help me?

Warning: Unable to access config.php in /mnt/kw1/05/051/00000001/htdocs/suche/stats/stats.php on line 13

Fatal error: Failed opening required 'config.php' (include_path='') in /mnt/kw1/05/051/00000001/htdocs/suche/stats/stats.php on line 13

Liberator
09-27-2004, 03:47 AM
I have install the MOD Stats following the instruction, but every time I get this error. Can you help me?

Warning: Unable to access config.php in /mnt/kw1/05/051/00000001/htdocs/suche/stats/stats.php on line 13

Fatal error: Failed opening required 'config.php' (include_path='') in /mnt/kw1/05/051/00000001/htdocs/suche/stats/stats.php on line 13

Hmmm - this indicates that stats.php cannot find config.php.... Did you install as per the instructions? If you did, then config.php sits in the same directory as stats.php so there should be no problem. If you did'nt then do it again ;)

config.php needs to be edited as per the instructions or it still won't work.

Ron Miller
09-27-2004, 06:14 AM
Thank you very much for replay. Yes, I have make the installation correct and the file "config.php" is on the same directory as the stats.php... I try also the "old" version of stats, but with the same error message.
Please excuse my english, I´m German.

I think I have found the problem. In my database is not available a table named "stats". How can I make this folder manuell? Thanks for help.

Last update:
This Tool works very fine and I´m happy that I spent some time for implementation.
For information:
- i have to create a table in my database named "stats". After this it starts
- i change the link in "stats.php" line 13 from "config.php" in the complete Path like (require "/home/strato/www/au/www.auslandsimmobilienportal.de/htdocs/suche/stats/config.php";) and now it work very fine...

Thank you very much for this great program.

Liberator
09-29-2004, 08:22 PM
Thank you very much for replay. Yes, I have make the installation correct and the file "config.php" is on the same directory as the stats.php... I try also the "old" version of stats, but with the same error message.
Please excuse my english, I´m German.

I think I have found the problem. In my database is not available a table named "stats". How can I make this folder manuell? Thanks for help.

Last update:
This Tool works very fine and I´m happy that I spent some time for implementation.
For information:
- i have to create a table in my database named "stats". After this it starts
- i change the link in "stats.php" line 13 from "config.php" in the complete Path like (require "/home/strato/www/au/www.auslandsimmobilienportal.de/htdocs/suche/stats/config.php";) and now it work very fine...

Thank you very much for this great program.

Hmm - the table 'stats' is created automatically the first time stats.php is run ie: someone loads a page with the stats code on it (assuming it doesn't already exist);


$q1 = "CREATE TABLE IF NOT EXISTS $sql_table ( time_str DATETIME default NULL, remote_host TEXT NOT NULL, request TEXT NOT NULL, referer TEXT NOT NULL, user_agent TEXT, screen_res TEXT, visits INT(11) default NULL , ipaddress TEXT NOT NULL, host_country INT(11) NOT NULL default '0', INDEX remote_time (remote_host(32),time_str))";
$r1 = mysql_query($q1);
if (!$r1){
print "query failed 1: " . mysql_error() . " : $query\n";
}
$query = "INSERT $sql_table (time_str, remote_host, request, referer, user_agent, screen_res, visits, ipaddress, host_country) VALUES (NOW(), $a_remote_host, $a_request, $a_referer, $a_user_agent, $a_screen_res, $a_visits, $a_ipaddress, $a_host_country)";

$result = mysql_query($query);
if (!$result){
print "query failed 2: " . mysql_error() . " : $query\n";
}

Maybe you tried to view the stats before the code was run? I also don't understand why you need the full path for config.php as it should be in the same directory as stats.php which is calling it??????

Anyway, I'm pleased that you have got the code working ok :)

Ron Miller
09-30-2004, 06:00 AM
Thank you very much, it works since 2 days without further problems.

Best regards from Germany.

Ron Miller
10-06-2004, 04:09 AM
There is a new problem. Perhaps someone have the same. After 1 week successful working, I cant see any details in the Module Stats.
I have nothing change or modified since 5-6 days…
Every time I can see all information, like, visitors, countries, screen resolution etc.
But since yesterday I see just the summery page for the month with user and hits. If I click to the link for further details there is no display after any seconds. In the database the data are available, but no display on the side.

http://www.auslandsimmobilienportal.de/suche/stats/index.php?year=2004&month=10

This is the Path but without results…. The side will be blank, with just the top navigation. After this I cant "logout". I have to close the browser and start again...

Now it comes a little bit confused… I have delete the old table „stats“ in my Database an create a new one „stats“ and… it works again. Is it possible that I made a too small table or what ever?

Thanks for help again.

Rene

Liberator
10-06-2004, 11:02 PM
There is a new problem. Perhaps someone have the same. After 1 week successful working, I cant see any details in the Module Stats.
I have nothing change or modified since 5-6 days…
Every time I can see all information, like, visitors, countries, screen resolution etc.
But since yesterday I see just the summery page for the month with user and hits. If I click to the link for further details there is no display after any seconds. In the database the data are available, but no display on the side.

http://www.auslandsimmobilienportal.de/suche/stats/index.php?year=2004&month=10

This is the Path but without results…. The side will be blank, with just the top navigation. After this I cant "logout". I have to close the browser and start again...

Now it comes a little bit confused… I have delete the old table „stats“ in my Database an create a new one „stats“ and… it works again. Is it possible that I made a too small table or what ever?

Thanks for help again.

Rene

How many hits are you getting each day roughly? Part of the update process to detect the country of the visitor requires the server to do a host lookup from the IP Address for each visitor. This is done on any new records added since you last loaded stats/index.php. If you have a large number of new records this process can take some time (for me it takes maybe 35 seconds to look up 100+ new visitors). It is possible (and has happened to me) that the browser times out, but a simple 'refresh' usually fixes that.

Maybe you just need to be more patient or make sure you run the update (by loading index.php) more frequently?

Ron Miller
10-07-2004, 05:03 AM
Hello,

yes, this is the problem so far. I delete all datas from the table “stast” and its run perfect. I think the problem is (to much… never!) Visitors every day nearly 300 with 5000 Hits. I think this is to much for the “Stats”. Now I create a Crown Job for delete the files in intervals of 5 days and I hope I fix the problem with this.

Best regards from German

Rene

Liberator
10-08-2004, 03:06 AM
Hello,

yes, this is the problem so far. I delete all datas from the table “stast” and its run perfect. I think the problem is (to much… never!) Visitors every day nearly 300 with 5000 Hits. I think this is to much for the “Stats”. Now I create a Crown Job for delete the files in intervals of 5 days and I hope I fix the problem with this.

Best regards from German

Rene

The problem almost certainly is the host lookup which is part of the update process that is performed each time you load index.php. If you have some IP addresses that cannot be resolved, the script waits before timeing out and moving on to the next one. It will only try each failed record once as failed lookups are filled with 'unknown'. For me, it seems to be about 10 seconds for each unresolved host, so if you have many of these it will take a long time. I'm sure there must be a way to shorten this timeout but I haven't had enough time to check it out (anybody got any ideas?).

Another option would be to create a CRON job to run the update regularly.