Ravens PHP Scripts: Forums
 

 

View next topic
View previous topic
Post new topic   Reply to topic    Ravens PHP Scripts And Web Hosting Forum Index -> RavenNuke(tm) v2.5x
Author Message
AndyB
Worker
Worker



Joined: Jun 03, 2004
Posts: 231
Location: Torrevieja, Spain

PostPosted: Sat Apr 21, 2012 5:18 am Reply with quote

Hi chaps;

another couple of quick ones... (you sick of me yet? Cool )

In statistics, for Firefox is just shows

"Firefox % ()"

I remember something from a LONG time ago that needed to be "tweaked" to get it to work- I changed line 95 in /modules/Statistics/index.php "FireFox" to "Firefox" - will this affect anywhere else on the site, and is this something down to my individual installation?

Also- is it possible to determine/ add Android, iOS and Blackberry (?) to the stats? (I'm guessing windows mobile will show with Windows?)

Thanks.
 
View user's profile Send private message
eldorado
Involved
Involved



Joined: Sep 10, 2008
Posts: 424
Location: France,Translator

PostPosted: Sat Apr 21, 2012 7:29 am Reply with quote

Yes , you can modify two files to add what you want.

In includes/counter.php
Code:
   // Yes, gather statistics

   /* Get the Browser data */
   //if ((stristr($_SERVER['HTTP_USER_AGENT'], 'Nav')) || (stristr($_SERVER['HTTP_USER_AGENT'], 'Gold')) || (stristr($_SERVER['HTTP_USER_AGENT'], 'X11')) || (stristr($_SERVER['HTTP_USER_AGENT'], 'Mozilla')) || (stristr($_SERVER['HTTP_USER_AGENT'], 'Netscape')) AND (!stristr($_SERVER['HTTP_USER_AGENT'], 'MSIE')) AND (!stristr($_SERVER['HTTP_USER_AGENT'], 'Konqueror')) AND (!stristr($_SERVER['HTTP_USER_AGENT'], 'Yahoo')) AND (!stristr($_SERVER['HTTP_USER_AGENT'], 'Firefox'))) $browser = 'Netscape';
   if ((stristr($_SERVER['HTTP_USER_AGENT'], 'Navigator')) || (stristr($_SERVER['HTTP_USER_AGENT'], 'Netscape'))) $browser = 'Netscape';
   elseif (stristr($_SERVER['HTTP_USER_AGENT'], 'Firefox')) $browser = 'FireFox';
   elseif (stristr($_SERVER['HTTP_USER_AGENT'], 'MSIE')) $browser = 'MSIE';
   elseif (stristr($_SERVER['HTTP_USER_AGENT'], 'Lynx')) $browser = 'Lynx';
   elseif (stristr($_SERVER['HTTP_USER_AGENT'], 'Opera')) $browser = 'Opera';
   elseif (stristr($_SERVER['HTTP_USER_AGENT'], 'WebTV')) $browser = 'WebTV';
   elseif (stristr($_SERVER['HTTP_USER_AGENT'], 'Konqueror')) $browser = 'Konqueror';
   elseif (stristr($_SERVER['HTTP_USER_AGENT'], 'Chrome')) $browser = 'Chrome';
   elseif ((stristr($_SERVER['HTTP_USER_AGENT'], 'Safari')) && (!stristr($_SERVER['HTTP_USER_AGENT'], 'Chrome'))) $browser = 'Safari';
   elseif ((stristr($_SERVER['HTTP_USER_AGENT'], 'bot')) || (stristr($_SERVER['HTTP_USER_AGENT'], 'Google')) || (stristr($_SERVER['HTTP_USER_AGENT'], 'Slurp')) || (stristr($_SERVER['HTTP_USER_AGENT'], 'Scooter')) || (stristr($_SERVER['HTTP_USER_AGENT'], 'Spider')) || (stristr($_SERVER['HTTP_USER_AGENT'], 'Infoseek'))) $browser = 'Bot';
   else $browser = 'Other';
   /* Get the Operating System data */
   if (stristr($_SERVER['HTTP_USER_AGENT'], 'Win')) $os = 'Windows';
   elseif ((stristr($_SERVER['HTTP_USER_AGENT'], 'Mac')) || (stristr($_SERVER['HTTP_USER_AGENT'], 'PPC'))) $os = 'Mac';
   elseif (stristr($_SERVER['HTTP_USER_AGENT'], 'Linux')) $os = 'Linux';
   elseif (stristr($_SERVER['HTTP_USER_AGENT'], 'FreeBSD')) $os = 'FreeBSD';
   elseif (stristr($_SERVER['HTTP_USER_AGENT'], 'SunOS')) $os = 'SunOS';
   elseif (stristr($_SERVER['HTTP_USER_AGENT'], 'IRIX')) $os = 'IRIX';
   elseif (stristr($_SERVER['HTTP_USER_AGENT'], 'BeOS')) $os = 'BeOS';
   elseif (stristr($_SERVER['HTTP_USER_AGENT'], 'OS/2')) $os = 'OS/2';
   elseif (stristr($_SERVER['HTTP_USER_AGENT'], 'AIX')) $os = 'AIX';
   else $os = 'Other';


you can add these to detect specific versions
Code:


//for browser again

elseif (stristr($_SERVER['HTTP_USER_AGENT'], 'Trident/4.0')) $browser = 'Internet Explorer 8';
elseif (stristr($_SERVER['HTTP_USER_AGENT'], 'Trident/5.0')) $browser = 'Internet Explorer 9';
//for os'es
elseif (stristr($_SERVER['HTTP_USER_AGENT'], 'Win64; IA64')) $os = 'Windows 64 bit';
elseif (stristr($_SERVER['HTTP_USER_AGENT'], 'Win64; x64')) $os = 'Windows 64 bit';



and for all mobile devices indifferent of what they are ,put before the
Code:
 else $os ='Other';

this code
Code:
$useragent=$_SERVER['HTTP_USER_AGENT'];

if(preg_match('/android.+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|symbian|treo|up\.(browser|link)|vodafone|wap|windows (ce|phone)|xda|xiino/i',$useragent)||preg_match('/1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|e\-|e\/|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(di|rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|xda(\-|2|g)|yas\-|your|zeto|zte\-/i',substr($useragent,0,4))) $os = 'Mobile OS';


of course ,
you'll have to add sql rows in the _counter db before doing that
Code:


INSERT INTO $prefix.`_counter` VALUES ('browser', 'Internet Explorer 8', '0');
INSERT INTO $prefix.`_counter` VALUES ('browser', 'Internet Explorer 9', '0');
INSERT INTO $prefix.`_counter` VALUES ('os', 'Windows 64 bit', '0');
INSERT INTO $prefix.`_counter` VALUES ('os', 'Mobile OS', '0');


and add these modification to modules/statistics/index.php

I'm sure i could give more details about what to add/remove , but that would take me to rewrite the module and i don't want to do that

keep us posted if you try this out

_________________
United-holy-dragons.net (My RN site)- Rejekz(cod4 clan) - gamerslounge 
View user's profile Send private message Visit poster's website MSN Messenger
AndyB







PostPosted: Sat Apr 21, 2012 10:23 am Reply with quote

Thanks.

Bizarrely after I posted, I added a few additional bits to /statistics/index and got it to show Android %() and knew I probably needed to add it elsewhere- I even went into cpanel looking in phpmyadmin for the agents to try to add it...

looking at your latter part of code, it looks like it just "clumps" all mobile OS together; is it possible to split out as mentioned (so ~I can possibly work out which mobile flavour of handset- iOS, BB or Android) visits the site most?
 
fkelly
Former Moderator in Good Standing



Joined: Aug 30, 2005
Posts: 3312
Location: near Albany NY

PostPosted: Sun Apr 22, 2012 7:42 am Reply with quote

If you have Cpanel you might want to check out awstats and see if that does what you want.

The statistics module is pretty primitive. I'm pretty sure I've seen undefined variable warning messages in it when testing locally. If I had my druthers I would eliminate it from RN entirely: there just isn't (IMHO) enough time to chase down and fix everything that's broken with our inherited code base. I comment out the calls to counter.php in my own systems: less overhead devoted to useless things.
 
View user's profile Send private message Visit poster's website
AndyB







PostPosted: Sun Apr 22, 2012 2:48 pm Reply with quote

Understood; that said, it can be useful for visitors/ advertisers. That said, the stats are usually way different to awstats or similar... so if stats are wrong, and website stats are right (I figured a difference due to *nuke* "nuances")- the site is getting no way near as much traffic as I thought?
 
fkelly







PostPosted: Sun Apr 22, 2012 3:10 pm Reply with quote

Quote:
.. so if stats are wrong, and website stats are right (I figured a difference due to *nuke* "nuances")- the site is getting no way near as much traffic as I thought?


Others know more about this topic than I do. I will just say that bots and search engines and the like really hammer my site(s) and probably inflate the statistics grossly. I don't know the methods behind awstats but I'd be more inclined to trust those than I would our statistics module. Our module gets run for every page load for every one (including search engines and bots) visiting the site.
 
AndyB







PostPosted: Sun Apr 22, 2012 3:22 pm Reply with quote

understood;- but in the stats module/ page it shows me the % of bots (Spiders?)....
MSIE: Internet Explorer 40.43 % (17703084)
FireFox: FireFox 9.418 % (4123098)
Netscape: Netscape 9.385 % (4108798)
Chrome: Chrome 1.830 % (801487)
Safari: Safari 1.544 % (676042)
Opera: Opera 0.693 % (303645)
Konqueror: (KDE)Konqueror 0.015 % (6975)
Lynx: Lynx 0.000 % (122)
Search Engines: Spiders 34.46 % (15087687)
Unknown: Other / Unknown 1.919 % (840500)
 
Guardian2003
Site Admin



Joined: Aug 28, 2003
Posts: 6799
Location: Ha Noi, Viet Nam

PostPosted: Sun Apr 22, 2012 6:54 pm Reply with quote

Well the 'bots' statistics are likely to be a little skewed. Most of the analysis is based on using some form of regex or useragent identification. This 'sifting' might have been perfectly adequate when the module was first written but as technology moves forward, sometimes there simply isn't the man-hours to keep specific modules bang up to date.
I believe some changes were made to it a while ago, most notably to correctly identify some Firefox and Opera versions.
RN isn't particularly mobile friendly (something that is currently being discussed and addressed) so I'm not sure how meaningful fine grained analysis of mobile device visits would be, since most mobile users probably wouldn't stay too long.

I would certainly agree that it would be nice to have *some* generic stats for mobile device visits for potential advertising clients but at the moment, Awstats or even Google Analytics is far superior in providing a more detailed and accurate analysis of visitor behaviour.

I'm not sure if Google Analytics has an API that could be leveraged into providing some publicly accessible data but it might be worth looking into.
 
View user's profile Send private message Send e-mail
AndyB







PostPosted: Mon Apr 23, 2012 1:57 am Reply with quote

Thanks for the feedback; I need to look into getting analytics onto the site (it has been on there in the past for someone/ a specific reason so would need to look at the old files to see if I can find where it was rem'ed out.

I'm watching the discussions regarding mobile devices/ themes with interest. I have a question about that, but I'll post it in the relevant forum (I work in mobile phone repair, so have access to MANY different types/ makes of handsets)

Cheers

Andy
 
spasticdonkey
RavenNuke(tm) Development Team



Joined: Dec 02, 2006
Posts: 1693
Location: Texas, USA

PostPosted: Mon Apr 23, 2012 10:49 am Reply with quote

excellent news regarding your access to mobile devices Smile

Looking forward to returning to the mobile theme but have been side-tracked working on the advanced bbcode mod. I myself don't even have a capable mobile device so it has been an interesting project... at least for once I don't have to worry how things look in IE! Smile

kguske came up with an analytics integration [ Only registered users can see links on this board! Get registered or login! ] which is also discussed a little here [ Only registered users can see links on this board! Get registered or login! ] - if that helps Wink
(note that there were changes to the analytics code and I posted another link in the thread above [ Only registered users can see links on this board! Get registered or login! ] )
 
View user's profile Send private message Visit poster's website
Display posts from previous:       
Post new topic   Reply to topic    Ravens PHP Scripts And Web Hosting Forum Index -> RavenNuke(tm) v2.5x

View next topic
View previous topic
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You can attach files in this forum
You can download files in this forum


Powered by phpBB © 2001-2007 phpBB Group
All times are GMT - 6 Hours
 
Forums ©