First of all let me apologize if this is not the correct place to post any of
this information. I really wish to share it with the project developers and
hopefully get more familiar with helping with this tool.
I was recently requested by work to generate statistics about mobile devices,
now this is not the first time I modify the awstats.pl file, but this would be
a first for sharing.
on the area for "# Define precompiled regex" I added a few new variables:
my$regverosiphone=qr/iPhone[_+ ]OS[_+ ]([\d_]*)/i;# iPhone OS versionmy$regverosipad=qr/iPad.*CPU[_+ ]OS[_+ ]([\d_\.]+)/i;# iPad OS Versionmy$regverosblackberry=qr/blackberry[_+ ]*([\d]+)/i;# Blackberry OS versionmy$regverosrimtablet=qr/PlayBook.*RIM[_+ ]Tablet[_+ ]OS[_+ ]([\d\.]*)/i;# Playbook RIM Tablet OSmy$regverosandroid=qr/Linux.*Android[_+ ]([\d\.]+)/i;# Android OS Version (No Build)my$regverosmac=qr/mac[_+ ]os[_+ ]x[_+ ]([\d\._]+)/i;# Mac OS X Version
And my "# Analyze: OS" area looks something like this
# Analyze: OS#------------my$uaos=$TmpOS{$UserAgent};if(!$uaos){my$found=1;# iPhone versionif($UserAgent=~ /$regverosiphone/o){my$tmp=$1;$tmp=~s/_/\./g;$_os_h{"iphone$tmp"}++;$TmpOS{$UserAgent}="iphone$tmp";}# iPad Version OS (Do Before MAC OS)elsif($UserAgent=~ /$regverosipad/o){my$tmp=$1;$tmp=~s/_/\./g;$_os_h{"ipad$tmp"}++;$TmpOS{$UserAgent}="ipad$tmp";}# Blackberry Version OSelsif($UserAgent=~ /$regverosblackberry/o){$_os_h{"blackberry$1"}++;$TmpOS{$UserAgent}="blackberry$1";# The following line is for troubleshooting# print $UserAgent."----".$TmpOS{$UserAgent}."---".$1."\n";}# PlayBook RIM Tabletelsif($UserAgent=~ /$regverosrimtablet/o){$_os_h{"playbook$1"}++;$TmpOS{$UserAgent}="playbook$1";}# Android Version OSelsif($UserAgent=~ /$regverosandroid/o){$_os_h{"android$1"}++;$TmpOS{$UserAgent}="android$1";}# Mac OS X Version elsif($UserAgent=~ /$regverosmac/o){my$tmp=$1;$tmp=~s/_/\./g;$_os_h{"macosx$tmp"}++;$TmpOS{$UserAgent}="macosx$tmp";}else{$found=0;# in OSHashID list ?foreach(@OSSearchIDOrder){# Search ID in order of OSSearchIDOrderif($UserAgent=~ /$_/){my$osid=$OSHashID{&UnCompileRegex($_)};$_os_h{"$osid"}++;$TmpOS{$UserAgent}="$osid";$found=1;last;}}}# Unknown OS ?if(!$found){$_os_h{'Unknown'}++;$TmpOS{$UserAgent}='Unknown';my$newua=$UserAgent;$newua=~tr/\+ /__/;$_unknownreferer_l{$newua}=$timerecord;}}else{$_os_h{$uaos}++;if($uaoseq'Unknown'){my$newua=$UserAgent;$newua=~tr/\+ /__/;$_unknownreferer_l{$newua}=$timerecord;}}}}else{$_browser_h{'Unknown'}++;$_os_h{'Unknown'}++;}
Of course other changes have been made in the "operating_systems.pm" and the
"browsers.pm".
So far I have not come across any issues.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hi,
First of all let me apologize if this is not the correct place to post any of
this information. I really wish to share it with the project developers and
hopefully get more familiar with helping with this tool.
I was recently requested by work to generate statistics about mobile devices,
now this is not the first time I modify the awstats.pl file, but this would be
a first for sharing.
on the area for "# Define precompiled regex" I added a few new variables:
And my "# Analyze: OS" area looks something like this
Of course other changes have been made in the "operating_systems.pm" and the
"browsers.pm".
So far I have not come across any issues.