File: awstats_extra.html

package info (click to toggle)
awstats 7.9-1
  • links: PTS
  • area: main
  • in suites: trixie
  • size: 13,724 kB
  • sloc: perl: 40,479; xml: 1,785; javascript: 1,493; java: 359; sh: 152; makefile: 40; php: 29
file content (357 lines) | stat: -rw-r--r-- 18,516 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<meta name="description" content="AWStats Documentation - Using the Extra Sections features">
<meta name="keywords" content="awstats, awstat, extra, section, sections, feature, features, report, extrasection">
<meta name="robots" content="index,follow">
<meta name="title" content="AWStats Documentation - Using the Extra Sections features">
<meta name="viewport" content="width=device-width, initial-scale=1.0"/>
<title>AWStats Documentation - Using the Extra Sections features</title>
<link rel="stylesheet" href="styles.css" type="text/css">
</head>

<body topmargin=10 leftmargin=5>


<table style="font: 10pt arial,helvetica,verdana" cellpadding=0 cellspacing=0 border=0 bgcolor=#FFFFFF width=100%>

<!-- Large -->
<tr style="font: 10pt arial,helvetica,verdana">
<td bgcolor=#9999cc align=center><a href="/"><img src="images/awstats_logo6.png" border=0></a></td>
<td bgcolor=#9999cc align=center>
<br>
<font style="font: 16pt arial,helvetica,sans-serif" color=#EEEEFF><b>AWStats logfile analyzer 7.8 Documentation</b></font><br>
<br>
</td>
<td bgcolor=#9999cc align=center>
&nbsp;
</td>
</tr>

</table>


<br><br><H1 style="font: 26px arial,helvetica,sans-serif">Adding extra reports using the ExtraSection feature</H1>

<br>
The AWStats ExtraSection features are powerfull setup options to allow you to add your own
report not provided by default with AWStats. You can use it to build special reports, like
number of sales for a particular product, marketing reports, counting for a particular
user or agent, etc...<br>
<br>

<br><br>
<u><b>Explanation on how to add/edit an Extra report in your config file</b></u><br>
Take a look inside the AWStats config file to find the following part:<br>
<i>
#-----------------------------------------------------------------------------<br>
# EXTRA SECTIONS<br>
#-----------------------------------------------------------------------------<br>
<br>
</i>
Read all explanation in config file after this point, they will explain you
how to add an Extra report by adding an ExtraSection configuration in your config file,<br>
or just click <a href="#extraconfig">here</a> to jump to a copy of this explanation.<br>
<br>
Following examples are precious tutorials...<br>

<a name="examples">&nbsp;</a>
<br><br>
<u><b>Some examples of ExtraSection setup you can follow to build your own personalized reports:</b></u><br>
<br>
<li><a href="#productorders">Example 1: Tracking Product orders</a><br>
<li><a href="#bugzilla">Example 2: Tracking Bugzilla most frequently viewed bugs</a><br>
<li><a href="#awredir">Example 3: Tracking Exit clicks</a><br>
<li><a href="#aborted">Example 4: Tracking aborted download</a><br>
<li><a href="#domainaliases">Example 5: Tracking most requested domain aliases</a><br>
<li><a href="#level2dir">Example 6: List of top level 2 path under a directory /mydir</a><br>
<br>

<br>
<br><a name="productorders"><H2 style="font: 18px arial,helvetica,sans-serif color: #606060"><u>Example 1: Tracking Product orders</u></H2></a>
Image your web site is an e-store that sells 80 different products. Each of them has an id.
Imagine each time, someone make an order for product 49, the order.cgi script or order2.cgi script
is called with, in URL query parameter, the id of the product, meanings that you get in your log
file a hit that looks like this:<br>
<table border=1 cellpadding=1 cellspacing=0 bgcolor=#F4F4F4 width="95%" class=CFAQ><tr class=CFAQ><td class=CFAQ>
GET /cgi-bin/order.cgi?productid=49&session=A0B1C2
</td></tr></table>
<br>
So this is how you need to setup your ExtraSection to track your product orders:<br>
<table border=1 cellpadding=1 cellspacing=0 bgcolor=#F4F4F4 width="95%" class=CFAQ><tr class=CFAQ><td class=CFAQ>
ExtraSectionName1="Product orders"
<br>ExtraSectionCodeFilter1="200 304"
<br>ExtraSectionCondition1="URL,\/cgi\-bin\/order\.cgi|URL,\/cgi\-bin\/order2\.cgi"
<br>ExtraSectionFirstColumnTitle1="Product ID"
<br>ExtraSectionFirstColumnValues1="QUERY_STRING,productid=([^&]+)"
<br>ExtraSectionFirstColumnFormat1="%s"
<br>ExtraSectionStatTypes1=PL
<br>ExtraSectionAddAverageRow1=0
<br>ExtraSectionAddSumRow1=1
<br>MaxNbOfExtra1=100
<br>MinHitExtra1=1
</td></tr></table>
<br>


<br>
<br><a name="bugzilla"><H2 style="font: 18px arial,helvetica,sans-serif color: #606060"><u>Example 2: Tracking Bugzilla most frequently viewed bugs</u></H2></a>
This is an example on how to setup your ExtraSection:<br>
<table border=1 cellpadding=1 cellspacing=0 bgcolor=#F4F4F4 width="95%" class=CFAQ><tr class=CFAQ><td class=CFAQ>
ExtraSectionName1="Bugzilla: Most frequently viewed bugs"
<br>ExtraSectionCodeFilter1="200 304"
<br>ExtraSectionCondition1="URL,\/bugzilla\/show_bug\.cgi"
<br>ExtraSectionFirstColumnTitle1="Bug ID"
<br>ExtraSectionFirstColumnValues1="QUERY_STRING,id=([^&]+)"
<br>ExtraSectionFirstColumnFormat1="&lt;a href='/bugzilla/show_bug.cgi?id=%s' target=new&gt;%s&lt;/a&gt;"
<br>ExtraSectionStatTypes1=PL
<br>ExtraSectionAddAverageRow1=0
<br>ExtraSectionAddSumRow1=1
<br>MaxNbOfExtra1=500
<br>MinHitExtra1=1
</td></tr></table>
<br>


<br>
<br><a name="awredir"><H2 style="font: 18px arial,helvetica,sans-serif color: #606060"><u>Example 3: Tracking Exit clicks</u></H2></a>
AWStats shows you naturally the exit pages. However, you don't know where you visitor go
after exiting your site since clicking on a link that point to an external link will log
the viewed page on the external server and not on yours.
If you want to track this, you can, using the ExtraSection and the <b>awredir.pl</b> tool
(provided with AWStats).<br>
This tools must be used as a CGI wrapper. When called on 'A HREF' link, it returns to
browser a redirector to tell it to show the required page.
So, to use this script, you must replace HTML href tags that points to external web sites
onto your HTML pages from<br>
<table border=1 cellpadding=1 cellspacing=0 bgcolor=#F4F4F4 width="95%" class=CFAQ><tr class=CFAQ><td class=CFAQ>
&lt;a href="http://externalsite/pagelinked"&gt;Link&lt;/a&gt;
</td></tr></table>
to<br>
<table border=1 cellpadding=1 cellspacing=0 bgcolor=#F4F4F4 width="95%" class=CFAQ><tr class=CFAQ><td class=CFAQ>
&lt;a href="http://yoursite/cgi-bin/awredir.pl?url=http://externalsite/pagelinked">Link&lt;/a&gt;
</td></tr></table>
<br>
For your web visitor, there is no difference. However this allow you to track
clicks done on links onto your web pages that point to external web sites,
because an entry will be seen in your own server log like this record:<br>
<table border=1 cellpadding=1 cellspacing=0 bgcolor=#F4F4F4 width="95%" class=CFAQ><tr class=CFAQ><td class=CFAQ>
80.1.2.3 - - [01/Jan/2001:16:00:00 -0300] "GET /cgi-bin/awredir.pl?url=http://externalsite/pagelinked HTTP/1.1" 302 70476 "http://yoursite/pagewithlink.html" "FireBird/0.7"<br>
</td></tr></table>
<br>
Then, you can add in AWStats a chart to track all call to <i>awredir.pl</i> with
keys values taken from the "url=" parameter. You will get an independant chart, counting
all external pages viewed by your visitor after exiting your site.<br>
To have this chart, this is how you must setup your ExtraSection:<br>
<table border=1 cellpadding=1 cellspacing=0 bgcolor=#F4F4F4 width="95%" class=CFAQ><tr class=CFAQ><td class=CFAQ>
ExtraSectionName1="Redirected Hit"
<br>ExtraSectionCodeFilter1="302"
<br>ExtraSectionCondition1="URL,\/cgi\-bin\/awredir\.pl"
<br>ExtraSectionFirstColumnTitle1="Url"
<br>ExtraSectionFirstColumnValues1="QUERY_STRING,url=([^&]+)"
<br>ExtraSectionStatTypes1=HL
<br>MaxNbOfExtra1=500
<br>MinHitExtra1=1
<br>ExtraSectionAddSumRow1=1
</td></tr></table>
<br><br>


<br><a name="aborted"><H2 style="font: 18px arial,helvetica,sans-serif color: #606060"><u>Example 4: Tracking aborted download</u></H2></a>
Aborted downloads are reported in a log file by a 206 error, so this is how you need to setup your ExtraSection to add a chart for a such tracking:<br>
<table border=1 cellpadding=1 cellspacing=0 bgcolor=#F4F4F4 width="95%" class=CFAQ><tr class=CFAQ><td class=CFAQ>
ExtraSectionName1="List of aborted download"
<br>ExtraSectionCodeFilter1="206"
<br>ExtraSectionCondition1=""
<br>ExtraSectionFirstColumnTitle1="URL"
<br>ExtraSectionFirstColumnValues1="URL,(.*)"
<br>ExtraSectionStatTypes1=PHB
<br>MaxNbOfExtra1=100
<br>MinHitExtra1=1
</td></tr></table>
<br><br>


<br><a name="domainaliases"><H2 style="font: 18px arial,helvetica,sans-serif color: #606060"><u>Example 5: Tracking most requested domain aliases</u></H2></a>
You have one website, but this web site has several domains named (for example the same site domain.com can be
reached with urls domain.com,www.domain.com,www.otherdomainname.com,www.againadomainname.org,...).
You want to know which domain alias is the most used.<br>
<br>
The first thing to do is to be sure the domain alias is recorded inside your log file.
If you use Apache, you must use a personalized Apache log file that contains the <i>%V</i> tag.
For example you can add in your Apache httpd.conf file a new Apache log format (This is
the Apache directive, not AWStats, to define an Apache log format that contains
the virtual domain):<br>
<table border=1 cellpadding=1 cellspacing=0 bgcolor=#F4F4F4 width="95%" class=CFAQ><tr class=CFAQ><td class=CFAQ>
LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\" %V" combinedv
</td></tr></table>
Then check that your Apache CustomLog directives are defined like this:<br>
<table border=1 cellpadding=1 cellspacing=0 bgcolor=#F4F4F4 width="95%" class=CFAQ><tr class=CFAQ><td class=CFAQ>
CustomLog pathtoyourlog/yourlog.log combinedv
</td></tr></table>
<br>
After restarting Apache, your log format should look like this<br>
<table border=1 cellpadding=1 cellspacing=0 bgcolor=#F4F4F4 width="95%" class=CFAQ><tr class=CFAQ><td class=CFAQ>
66.130.77.181 - - [09/Aug/2004:03:01:05 +0200] "GET /index.php HTTP/1.1" 200 1473 "-" "Firefox 1.0" www.otherdomainname.com<br>
</td></tr></table>
<br>

When your web server log file contains the domain alias, you can now setup AWStats
to use it. For this use a personalised AWStats log format and use the <i>%extra1</i> tag at
the same position where the domain alias is. For example, for your combinedv Apache log format,
we will use:<br>
<table border=1 cellpadding=1 cellspacing=0 bgcolor=#F4F4F4 width="95%" class=CFAQ><tr class=CFAQ><td class=CFAQ>
LogFormat="%host %other %logname %time1 %methodurl %code %bytesd %refererquot %uaquot %extra1"
</td></tr></table>
<br>
Every tag defined by name <i>extraZ</i> (Z is a number, you can use as many tags as you need)
can be used in any ExtraSection to extract the parameter. You can use the name <i>extraZ</i> as
a criteria in the <i>ExtraSectionFirstColumnValuesX</i> parameter (X is number of the extra report, you can
add as many report as you need) to tell AWStats to use value in log file at the place of
the tag, as the key for your report. For example:<br>
<table border=1 cellpadding=1 cellspacing=0 bgcolor=#F4F4F4 width="95%" class=CFAQ><tr class=CFAQ><td class=CFAQ>
ExtraSectionName1="Domains aliases"
<br>ExtraSectionCodeFilter1="200 304" 
<br>ExtraSectionCondition1=""
<br>ExtraSectionFirstColumnTitle1="Domain alias"
<br>ExtraSectionFirstColumnValues1="extra1,([^&]+)"
<br>ExtraSectionFirstColumnFormat1="%s"
<br>ExtraSectionStatTypes1=HL
<br>ExtraSectionAddAverageRow1=0
<br>ExtraSectionAddSumRow1=1
<br>MaxNbOfExtra1=20
<br>MinHitExtra1=1
</td></tr></table>
<br><br>
And result will be:
<style type="text/css">
<!--
.aws_bodyl  { }
.aws_border { background-color: #CCCCDD; padding: 1px 1px 1px 1px; margin-top: 0; margin-bottom: 0; }
.aws_title  { font: 13px verdana, arial, helvetica, sans-serif; font-weight: bold; background-color: #CCCCDD; text-align: center; margin-top: 0; margin-bottom: 0; padding: 1px 1px 1px 1px; color: #000000; }
.aws_blank  { font: 13px verdana, arial, helvetica, sans-serif; background-color: #CCCCDD; text-align: center; margin-bottom: 0; padding: 1px 1px 1px 1px; }
.aws_data {
	background-color: #FFFFFF;
	border-top-width: 1px;   
	border-left-width: 0px;  
	border-right-width: 0px; 
	border-bottom-width: 0px;
}
.aws_formfield { font: 13px verdana, arial, helvetica; }
.aws_button {
	font-family: arial,verdana,helvetica, sans-serif;
	font-size: 12px;
	border: 1px solid #ccd7e0;
	background-image : url(/awstatsicons/other/button.gif);
}
th		{ border-color: #ECECEC; border-left-width: 0px; border-right-width: 1px; border-top-width: 0px; border-bottom-width: 1px; padding: 1px 2px 1px 1px; font: 11px verdana, arial, helvetica, sans-serif; text-align:center; color: #000000; }
th.aws	{ border-color: #ECECEC; border-left-width: 0px; border-right-width: 1px; border-top-width: 0px; border-bottom-width: 1px; padding: 1px 2px 1px 1px; font-size: 13px; font-weight: bold; }
td	{ border-color: #ECECEC; border-left-width: 0px; border-right-width: 1px; border-top-width: 0px; border-bottom-width: 1px; font: 11px verdana, arial, helvetica, sans-serif; color: #000000; padding: 0px;}
td.awsm	{ border-left-width: 0px; border-right-width: 0px; border-top-width: 0px; border-bottom-width: 0px; font: 11px verdana, arial, helvetica, sans-serif; text-align:left; color: #000000; padding: 0px; }
//-->
</style>
<a name="extra6">&nbsp;</a><br /><table class="aws_border" border="0" cellpadding="2" cellspacing="0" width="100%">
<tr><td class="aws_title" width="70%">Domains aliases</td><td class="aws_blank">&nbsp;</td></tr>
<tr><td colspan="2">
<table class="aws_data" border="1" bordercolor="#ECECEC" cellpadding="2" cellspacing="0" width="100%">
<tr bgcolor="#ECECEC"><th>Domain alias</th><th align="center" bgcolor="#66F0FF" width="80">Hits</th><th width="120" align="center">Last visit</th></tr>
<tr><td class="aws">www.domain.com</td><td align="center">1757131</td><td align="center">08 August 2004 - 13:01</td></tr>
<tr><td class="aws">www.otherdomainname.com</td><td align="center">98518</td><td align="center">08 August 2004 - 12:54</td></tr>
<tr><td class="aws">domain.com</td><td align="center">19107</td><td align="center">08 August 2004 - 12:42</td></tr>
<tr><td class="aws">www.againadomainname.org</td><td align="center">7609</td><td align="center">08 August 2004 - 11:56</td></tr>
<tr><td class="aws"><b>Total</b></td><td align="center">1883986</td><td>&nbsp;</td></tr>
</table></td></tr></table><br />




<br><a name="level2dir"><H2 style="font: 18px arial,helvetica,sans-serif color: #606060"><u>Example 6: List of top level 2 path under a directory /mydir</u></H2></a>
So this is how you need to setup your ExtraSection to add a chart for such a tracking:<br>
<table border=1 cellpadding=1 cellspacing=0 bgcolor=#F4F4F4 width="95%" class=CFAQ><tr class=CFAQ><td class=CFAQ>
ExtraSectionName1="List of top level 2 path under /mydir"
<br>ExtraSectionCodeFilter1="200 304"
<br>ExtraSectionCondition1="URL,^\/mydir\/.*"
<br>ExtraSectionFirstColumnTitle1="Directory name"
<br>ExtraSectionFirstColumnValues1="URL,^\/mydir\/([\w]+)\/"
<br>ExtraSectionStatTypes1=PHK
<br>MaxNbOfExtra1=50
<br>MinHitExtra1=1
</td></tr></table>
<br><br>


<br><br>
There is a lot of other possible use for Extra Sections ...<br>
<br>

<br>
<br>
<br>


<a name="extraconfig"></a>
<br>
<u><b>The following explanation is same than the one found in AWStats config file:</b></u><br>
<br>#-----------------------------------------------------------------------------
<br># EXTRA SECTIONS
<br>#-----------------------------------------------------------------------------
<br># You can define your own charts, you choose here what are rows and columns
<br># keys. This feature is particularly usefull for marketing purpose, tracking
<br># products orders for example.
<br># For this, edit all parameters of Extra section. Each set of parameter is a
<br># different chart. For several charts, duplicate section changing the number.
<br># Note: Each Extra section reduces AWStats speed by 8%.
<br>#
<br># WARNING: A wrong setup of Extra section might result in too large arrays
<br># that will consume all your memory, making AWStats unusable after several
<br># updates, so be sure to setup it correctly.
<br># In most cases, you don't need this feature.
<br>#
<br># ExtraSectionNameX is title of your personalized chart.
<br># ExtraSectionCodeFilterX is list of codes the record code field must match.
<br>#   Put an empty string for no test on code.
<br># ExtraSectionConditionX are conditions you can use to count or not the hit,
<br>#   Use one of the field condition
<br>#   (URL,URLWITHQUERY,QUERY_STRING,REFERER,UA,HOSTINLOG,HOST,VHOST,extraX)
<br>#   and a regex to match, after a coma. Use "||" for "OR".
<br># ExtraSectionFirstColumnTitleX is the first column title of the chart.
<br># ExtraSectionFirstColumnValuesX is a string to tell AWStats which field to
<br>#   extract value from
<br>#   (URL,URLWITHQUERY,QUERY_STRING,REFERER,UA,HOSTINLOG,HOST,VHOST,extraX)
<br>#   and how to extract the value (using regex syntax). Each different value
<br>#   found will appear in first column of report on a different row. Be sure
<br>#   that list of different possible values will not grow indefinitely.
<br># ExtraSectionFirstColumnFormatX is the string used to write value.
<br># ExtraSectionStatTypesX are things you want to count. You can use standard
<br>#   code letters (P for pages,H for hits,B for bandwidth,L for last access).
<br># ExtraSectionAddAverageRowX add a row at bottom of chart with average values.
<br># ExtraSectionAddSumRowX add a row at bottom of chart with sum values.
<br># MaxNbOfExtraX is maximum number of rows shown in chart.
<br># MinHitExtraX is minimum number of hits required to be shown in chart.

<br><br>
Warning: the ExtraSectionConditionX MUST use regex values since AWStats 6.0.<br>
ExtraSectionFirstColumnValuesX also need REGEX value for all AWStats versions.<br>
Return to <a href="#examples">examples</a> for examples on syntax use.<br>
<br>




<br>
<hr>

<!-- You can remove this part if you distribution need documentation without external tags -->
<!-- BEGIN_SOCIAL_NETWORKS -->
<div class="htmldoc-ignore">
<!-- google plus -->
<span style="color: #bbb; font-weight: normal;">Article written by <a href="https://www.destailleur.fr/awstats.php?category=awstats?rel=author" rel="author" style="color: #ccc; font-weight: normal;">Laurent Destailleur</a>.</span><br>
<br>
<!-- twitter -->
<a href="https://twitter.com/awstats_project" class="twitter-follow-button" data-show-count="false">Follow @awstats_project</a>
</div>
<!-- END_SOCIAL_NETWORKS -->


</body>
</html>