122
127
browser a redirector to tell it to show the required page.
123
128
So, to use this script, you must replace HTML href tags that points to external web sites
124
129
onto your HTML pages from<br>
125
<i><a href="http://externalsite/pagelinked">Link</a><br></i>
130
<table border=1 cellpadding=1 cellspacing=0 bgcolor=#F4F4F4 width="95%" class=CFAQ><tr class=CFAQ><td class=CFAQ>
131
<a href="http://externalsite/pagelinked">Link</a>
127
<i><a href="http://yoursite/cgi-bin/awredir.pl?url=http://externalsite/pagelinked">Link</a><br></i>
134
<table border=1 cellpadding=1 cellspacing=0 bgcolor=#F4F4F4 width="95%" class=CFAQ><tr class=CFAQ><td class=CFAQ>
135
<a href="http://yoursite/cgi-bin/awredir.pl?url=http://externalsite/pagelinked">Link</a>
129
138
For your web visitor, there is no difference. However this allow you to track
130
139
clicks done on links onto your web pages that point to external web sites,
131
140
because an entry will be seen in your own server log like this record:<br>
141
<table border=1 cellpadding=1 cellspacing=0 bgcolor=#F4F4F4 width="95%" class=CFAQ><tr class=CFAQ><td class=CFAQ>
133
142
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>
136
145
Then, you can add in AWStats a chart to track all call to <i>awredir.pl</i> with
137
146
keys values taken from the "url=" parameter. You will get an independant chart, counting
138
147
all external pages viewed by your visitor after exiting your site.<br>
139
148
To have this chart, this is how you must setup your ExtraSection:<br>
141
<br>ExtraSectionName1="Redirected Hit"
149
<table border=1 cellpadding=1 cellspacing=0 bgcolor=#F4F4F4 width="95%" class=CFAQ><tr class=CFAQ><td class=CFAQ>
150
ExtraSectionName1="Redirected Hit"
142
151
<br>ExtraSectionCodeFilter1="302"
143
152
<br>ExtraSectionCondition1="URL,\/cgi\-bin\/awredir\.pl"
144
153
<br>ExtraSectionFirstColumnTitle1="Url"
176
185
For example you can add in your Apache httpd.conf file a new Apache log format (This is
177
186
the Apache directive, not AWStats, to define an Apache log format that contains
178
187
the virtual domain):<br>
179
<i>LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\" %V" combinedv</i><br>
188
<table border=1 cellpadding=1 cellspacing=0 bgcolor=#F4F4F4 width="95%" class=CFAQ><tr class=CFAQ><td class=CFAQ>
189
LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\" %V" combinedv
180
191
Then check that your Apache CustomLog directives are defined like this:<br>
181
<i>CustomLog pathtoyourlog/yourlog.log combinedv</i><br>
192
<table border=1 cellpadding=1 cellspacing=0 bgcolor=#F4F4F4 width="95%" class=CFAQ><tr class=CFAQ><td class=CFAQ>
193
CustomLog pathtoyourlog/yourlog.log combinedv
183
196
After restarting Apache, your log format should look like this<br>
197
<table border=1 cellpadding=1 cellspacing=0 bgcolor=#F4F4F4 width="95%" class=CFAQ><tr class=CFAQ><td class=CFAQ>
184
198
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>
187
202
When your web server log file contains the domain alias, you can now setup AWStats
188
203
to use it. For this use a personalised AWStats log format and use the <i>%extra1</i> tag at
189
the same place that the domain alias is. For example, for your combinedv Apache log format,
204
the same position where the domain alias is. For example, for your combinedv Apache log format,
191
<i>LogFormat="%host %other %logname %time1 %methodurl %code %bytesd %refererquot %uaquot %extra1"</i><br>
206
<table border=1 cellpadding=1 cellspacing=0 bgcolor=#F4F4F4 width="95%" class=CFAQ><tr class=CFAQ><td class=CFAQ>
207
LogFormat="%host %other %logname %time1 %methodurl %code %bytesd %refererquot %uaquot %extra1"
193
210
Every tag defined by name <i>extraZ</i> (Z is a number, you can use as many tags as you need)
194
211
can be used in any ExtraSection to extract the parameter. You can use the name <i>extraZ</i> as
195
212
a criteria in the <i>ExtraSectionFirstColumnValuesX</i> parameter (X is number of the extra report, you can
196
213
add as many report as you need) to tell AWStats to use value in log file at the place of
197
214
the tag, as the key for your report. For example:<br>
199
<br>ExtraSectionName1="Domains aliases"
215
<table border=1 cellpadding=1 cellspacing=0 bgcolor=#F4F4F4 width="95%" class=CFAQ><tr class=CFAQ><td class=CFAQ>
216
ExtraSectionName1="Domains aliases"
200
217
<br>ExtraSectionCodeFilter1="200 304"
201
<br>ExtraSectionCondition1=""
202
<br>ExtraSectionFirstColumnTitle1="Domain alias"
203
<br>ExtraSectionFirstColumnValues1="extra1,([^&]+)"
204
<br>ExtraSectionFirstColumnFormat1="%s"
205
<br>ExtraSectionStatTypes1=HL
206
<br>ExtraSectionAddAverageRow1=0
207
<br>ExtraSectionAddSumRow1=1
218
<br>ExtraSectionCondition1=""
219
<br>ExtraSectionFirstColumnTitle1="Domain alias"
220
<br>ExtraSectionFirstColumnValues1="extra1,([^&]+)"
221
<br>ExtraSectionFirstColumnFormat1="%s"
222
<br>ExtraSectionStatTypes1=HL
223
<br>ExtraSectionAddAverageRow1=0
224
<br>ExtraSectionAddSumRow1=1
212
229
And result will be:
213
<style type="text/css">
216
.aws_border { background-color: #CCCCDD; padding: 1px 1px 1px 1px; margin-top: 0; margin-bottom: 0; }
217
.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; }
218
.aws_blank { font: 13px verdana, arial, helvetica, sans-serif; background-color: #CCCCDD; text-align: center; margin-bottom: 0; padding: 1px 1px 1px 1px; }
220
background-color: #FFFFFF;
221
border-top-width: 1px;
222
border-left-width: 0px;
223
border-right-width: 0px;
224
border-bottom-width: 0px;
226
.aws_formfield { font: 13px verdana, arial, helvetica; }
228
font-family: arial,verdana,helvetica, sans-serif;
230
border: 1px solid #ccd7e0;
231
background-image : url(/awstatsicons/other/button.gif);
233
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; }
234
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; }
235
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;}
236
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; }
230
<style type="text/css">
233
.aws_border { background-color: #CCCCDD; padding: 1px 1px 1px 1px; margin-top: 0; margin-bottom: 0; }
234
.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; }
235
.aws_blank { font: 13px verdana, arial, helvetica, sans-serif; background-color: #CCCCDD; text-align: center; margin-bottom: 0; padding: 1px 1px 1px 1px; }
237
background-color: #FFFFFF;
238
border-top-width: 1px;
239
border-left-width: 0px;
240
border-right-width: 0px;
241
border-bottom-width: 0px;
243
.aws_formfield { font: 13px verdana, arial, helvetica; }
245
font-family: arial,verdana,helvetica, sans-serif;
247
border: 1px solid #ccd7e0;
248
background-image : url(/awstatsicons/other/button.gif);
250
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; }
251
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; }
252
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;}
253
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; }
239
<a name="extra6"> </a><br /><table class="aws_border" border="0" cellpadding="2" cellspacing="0" width="100%">
240
<tr><td class="aws_title" width="70%">Domains aliases</td><td class="aws_blank"> </td></tr>
242
<table class="aws_data" border="1" bordercolor="#ECECEC" cellpadding="2" cellspacing="0" width="100%">
243
<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>
244
<tr><td class="aws">www.domain.com</td><td align="center">1757131</td><td align="center">08 August 2004 - 13:01</td></tr>
245
<tr><td class="aws">www.otherdomainname.com</td><td align="center">98518</td><td align="center">08 August 2004 - 12:54</td></tr>
246
<tr><td class="aws">domain.com</td><td align="center">19107</td><td align="center">08 August 2004 - 12:42</td></tr>
247
<tr><td class="aws">www.againadomainname.org</td><td align="center">7609</td><td align="center">08 August 2004 - 11:56</td></tr>
248
<tr><td class="aws"><b>Total</b></td><td align="center">1883986</td><td> </td></tr>
249
</table></td></tr></table><br />
256
<a name="extra6"> </a><br /><table class="aws_border" border="0" cellpadding="2" cellspacing="0" width="100%">
257
<tr><td class="aws_title" width="70%">Domains aliases</td><td class="aws_blank"> </td></tr>
259
<table class="aws_data" border="1" bordercolor="#ECECEC" cellpadding="2" cellspacing="0" width="100%">
260
<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>
261
<tr><td class="aws">www.domain.com</td><td align="center">1757131</td><td align="center">08 August 2004 - 13:01</td></tr>
262
<tr><td class="aws">www.otherdomainname.com</td><td align="center">98518</td><td align="center">08 August 2004 - 12:54</td></tr>
263
<tr><td class="aws">domain.com</td><td align="center">19107</td><td align="center">08 August 2004 - 12:42</td></tr>
264
<tr><td class="aws">www.againadomainname.org</td><td align="center">7609</td><td align="center">08 August 2004 - 11:56</td></tr>
265
<tr><td class="aws"><b>Total</b></td><td align="center">1883986</td><td> </td></tr>
266
</table></td></tr></table><br />
254
271
<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>
255
So this is how you need to setup your ExtraSection to add a chart for a such tracking:<br>
257
<br>ExtraSectionName1="List of top level 2 path under /mydir"
272
So this is how you need to setup your ExtraSection to add a chart for such a tracking:<br>
273
<table border=1 cellpadding=1 cellspacing=0 bgcolor=#F4F4F4 width="95%" class=CFAQ><tr class=CFAQ><td class=CFAQ>
274
ExtraSectionName1="List of top level 2 path under /mydir"
258
275
<br>ExtraSectionCodeFilter1="200 304"
259
276
<br>ExtraSectionCondition1="URL,^\/mydir\/.*"
260
277
<br>ExtraSectionFirstColumnTitle1="Directory name"
297
314
<br># ExtraSectionCodeFilterX is list of codes the record code field must match.
298
315
<br># Put an empty string for no test on code.
299
316
<br># ExtraSectionConditionX are conditions you can use to count or not the hit,
300
<br># Use one of the field condition (URL,QUERY_STRING,REFERER,UA,HOST)
301
<br># and a regex to match, after a coma. Use "|" for "OR".
317
<br># Use one of the field condition (URL,URLWITHQUERY,QUERY_STRING,REFERER,UA,
318
<br># HOST,extraX) and a regex to match, after a coma. Use "||" for "OR".
302
319
<br># ExtraSectionFirstColumnTitleX is the first column title of the chart.
303
<br># ExtraSectionFirstColumnValuesX is a Regex string to tell AWStats in which
304
<br># field to extract value from (URL,QUERY_STRING,REFERER,UA,HOST)
320
<br># ExtraSectionFirstColumnValuesX is a string to tell AWStats which field to
321
<br># extract value from (URL,URLWITHQUERY,QUERY_STRING,REFERER,UA,HOST,extraX)
305
322
<br># and how to extract the value (using regex syntax). Each different value
306
323
<br># found will appear in first column of report on a different row. Be sure
307
324
<br># that list of different possible values will not grow indefinitely.