Learn how easy it is to sync an existing GitHub or Google Code repo to a SourceForge project! See Demo

Close

Opera Version Numbers

2006-03-11
2013-10-28
  • Hi,

    I love your AWstats tool and it's really great. Is it possible to add Version Support for Opera Browsers, that I am able to see which version my users use.

    Thanks in advance.

     
  • GwenDragon
    GwenDragon
    2013-10-07

    May be this will fix the version number problem.
    Detects old Opera versions and new Opera Stable (>= Opera 15) builds.

    In Perl program awstats.pl replace

    my $regveropera = qr/opera\/([\d\.]*)/i;
    

    with

    #my $regveropera = qr/opera\/([\d\.]*)/i;
    # OPR/15.0.1266 means Opera 15 
    # Opera/9.80 ...... Version/12.16 means Opera 12.16
    # Mozilla/5.0 .... Opera 11.51 means Opera 11.51
    #
    my $regveropera = qr/opera\/9\.80\s.+\sversion\/([\d\.]+)|ope?ra?[\/\s]([\d\.]+)/i;
    

    And an other code movement to detect Opera even if it is masked as Firefox ode Internet Explorer.

    Replace this code part

    # Firefox ?
    if (   $UserAgent =~ /$regverfirefox/o
        && $UserAgent !~ /$regnotfirefox/o )
    {
        $_browser_h{"firefox$1"}++;
        if ($PageBool) { $_browser_p{"firefox$1"}++; }
        $TmpBrowser{$UserAgent} = "firefox$1";
    }
    
    # Opera ?
    elsif ( $UserAgent =~ /$regveropera/o ) {
    
        $_browser_h{"opera$1"}++;
        if ($PageBool) { $_browser_p{"opera$1"}++; }
        $TmpBrowser{$UserAgent} = "opera$1";
    }
    

    with

    # Opera ?
    if ( $UserAgent =~ /$regveropera/o ) {
                # !!!! version number in in regex $1 or $2 !!!
        $_browser_h{"opera".($1||$2)}++;
        if ($PageBool) { $_browser_p{"opera".($1||$2)}++; }
                $TmpBrowser{$UserAgent} = "opera".($1||$2);
    }
    
    # Firefox ?
    elsif (   $UserAgent =~ /$regverfirefox/o
        && $UserAgent !~ /$regnotfirefox/o )
    {
        $_browser_h{"firefox$1"}++;
        if ($PageBool) { $_browser_p{"firefox$1"}++; }
        $TmpBrowser{$UserAgent} = "firefox$1";
    }
    

    That works in awstats 7.1.1

    For UserAgent strings of Opera see http://www.useragentstring.com/pages/Opera/ and http://my.opera.com/ODIN/blog/2013/07/15/opera-user-agent-strings-opera-15-and-beyond

     
    Last edit: GwenDragon 2013-10-27
    • Thanks for this patch.
      Added into dev branch.