]> git.ipfire.org Git - thirdparty/AWStats.git/commitdiff
Add URLWithQuery option
authoreldy <>
Sun, 9 Sep 2001 21:55:10 +0000 (21:55 +0000)
committereldy <>
Sun, 9 Sep 2001 21:55:10 +0000 (21:55 +0000)
wwwroot/cgi-bin/awstats.model.conf
wwwroot/cgi-bin/awstats.pl

index 255abcf072e24d297b7696797fdbe629db0d199d..e6819adaa651ce34fce0eafaac66e3b03543f99c 100644 (file)
@@ -43,6 +43,7 @@ LogFile="/var/log/httpd/mylog.log"
 # %methodurlnoprot    Method and URL with format "GET /index.html"
 # %method             Method with format GET
 # %url                URL only with format /index.html
+# %query              Query string (used by URLWithQuery option)
 # %code               HTTP return code with format xxx
 # %bytesd             Size of document in bytes
 # %refererquot        Referer page with format "http://from.com/from.htm"
@@ -240,6 +241,24 @@ SkipFiles="\.css$ \.js$ \.class$ robots\.txt$"
 #
 OnlyFiles=""
 
+# Keep or attach the query string to the URL in the statistics for individual
+# pages. This is primarily used to differentiate between the URLs of dynamic
+# pages.
+# Possible values:
+# 0 - URLs are cleaned from the query string (ie: "/mypage.html")
+# 1 - Full URL with query string is used     (ie: "/mypage.html?x=y")
+# Default: 0
+# 
+URLWithQuery=0
+
+# Search engines keywords reported are full search string or separate keywords
+# Possible values:
+# 0 - Search keywords reported are full search string (ie: "town maps")
+# 1 - Search keywords reported are separated words (ie: "town" and "maps")
+# Default: 0
+#
+SplitSearchString=0
+
 # AWStats can detect setup problems or show you important informations to have
 # a better use. Keep this to 1, except if AWStats says you can change it.
 # Possible values: 1 or 0
@@ -265,14 +284,6 @@ ShowFlagLinks=1
 #
 ShowLinksOnUrl=1
 
-# Search engines keywords reported are full search string or separate keywords
-# Possible values:
-# 0 - Search keywords reported are full search string (ie: "town maps")
-# 1 - Search keywords reported are separated words (ie: "town" and "maps")
-# Default: 0
-#
-SplitSearchString=0
-
 # You can put here HTML code that will be added at the end of AWStats reports.
 # Great to add advert ban.
 # Default: ""
index 9c6b5e1166ec74f38d70034059f9a570a66acdb6..ca8bc74e6b5747196c21a7d554bc52a69a12a90d 100644 (file)
@@ -58,7 +58,7 @@ $ShowFlagLinks, $ShowLinksOnURL, $ShowLinksOnUrl, $ShowSteps,
 $SiteConfig, $SiteDomain, $SiteToAnalyze, $SiteToAnalyzeWithoutwww,
 $TotalBytes, $TotalDifferentPages, $TotalErrors, $TotalHits,
 $TotalHostsKnown, $TotalHostsUnKnown, $TotalPages, $TotalUnique, $TotalVisits,
-$URLFilter, $UserAgent, $WarningMessages, $YearRequired, 
+$URLFilter, $URLWithQuery, $UserAgent, $WarningMessages, $YearRequired, 
 $color_Background, $color_TableBG, $color_TableBGRowTitle,
 $color_TableBGTitle, $color_TableBorder, $color_TableRowTitle, $color_TableTitle,
 $color_h, $color_k, $color_link, $color_p, $color_s, $color_v, $color_w, $color_weekend,
@@ -71,7 +71,7 @@ $found, $internal_link, $new) = ();
 %MonthBytes = %MonthHits = %MonthHostsKnown = %MonthHostsUnknown = %MonthPages = %MonthUnique = %MonthVisits =
 %monthlib = %monthnum = ();
 
-$VERSION="3.1 (build 41)";
+$VERSION="3.2 (build 1)";
 $Lang="en";
 
 # Default value
@@ -1000,6 +1000,7 @@ sub Read_Config_File {
                        next;
                        }
                if ($param =~ /^LogFormat/)            { $LogFormat=$value; next; }
+               if ($param =~ /^URLWithQuery/)         { $URLWithQuery=$value; next; }
                if ($param =~ /^AllowToUpdateStatsFromBrowser/) { $AllowToUpdateStatsFromBrowser=$value; next; }
                if ($param =~ /^HostAliases/) {
                        my @felter=split(/\s+/,$value);
@@ -1176,6 +1177,7 @@ sub Check_Config {
        if ($LogFormat =~ /^[\d]$/ && $LogFormat !~ /[1-4]/)  { error("Error: LogFormat parameter is wrong. Value is '$LogFormat' (should be 1 or 2 or a 'personalised AWtats log format string')"); }
        if ($DNSLookup !~ /[0-1]/)                            { error("Error: DNSLookup parameter is wrong. Value is '$DNSLookup' (should be 0 or 1)"); }
        # Optional section
+       if ($URLWithQuery !~ /[0-1]/)                { $URLWithQuery=0; }
        if ($AllowToUpdateStatsFromBrowser !~ /[0-1]/) { $AllowToUpdateStatsFromBrowser=1; }    # For compatibility, is 1 if not defined
        if ($PurgeLogFile !~ /[0-1]/)                { $PurgeLogFile=0; }
        if ($ArchiveLogRecords !~ /[0-1]/)           { $ArchiveLogRecords=1; }
@@ -2031,6 +2033,12 @@ if ($UpdateStats) {
                                $i++;
                                $PerlParsingFormat .= "([^\\s]*) ";
                        }
+                       if ($f =~ /%query$/ || $f =~ /cs-uri-query$/) {
+                               $found=1; 
+                               $pos_query = $i;
+                               $i++;
+                               $PerlParsingFormat .= "([^\\s]*) ";
+                       }
                        if ($f =~ /%code$/ || $f =~ /%.*>s$/ || $f =~ /sc-status$/) {
                                $found=1; 
                                $pos_code = $i;
@@ -2215,8 +2223,15 @@ if ($UpdateStats) {
                }
 
                # Canonize and clean target URL and referrer URL
+               if ($URLWithQuery) {                            
+                       # We combine the URL and query strings.
+                       if ($field[$pos_query] && ($field[$pos_query] ne "-")) { $field[$pos_url] .= "?" . $field[$pos_query]; }
+               }
+               else {
+                       # Trunc CGI parameters in URL
+                       $field[$pos_url] =~ s/\?.*//;
+               }
                $field[$pos_url] =~ s/\/$DefaultFile$/\//;      # Replace default page name with / only
-               $field[$pos_url] =~ s/\?.*//;                           # Trunc CGI parameters in URL get
                $field[$pos_url] =~ s/\/\//\//g;                        # Because some targeted url were taped with 2 / (Ex: //rep//file.htm)
 
                # Check if page or not