Thursday, September 27, 2007

How to Get some Visitor Reporting from your Domino Web Server

This isn't intended to be the greatest method, but provides a quick method for setting up a means of reporting web site hits.

1. Copy the Domino Web Server Log Template so that you don't overwrite the original.

2. Create a new view (or better still copy/paste and rename the All Requests View).

3. Change the Selection Criteria to something like this...

REM {Normalize the adress: remove leading 'www.' and trailing ':'};

_server := @LowerCase(ServerAddress);

_hasPrefix := @If(@Left(_server; 4) = "www."; @True; @False);
_hasPort := @If(@Contains(_server; ":"); @True; @False);

_address := @If(_hasPrefix; @RightBack(_server; 4); _server);
_address := @If(_hasPort; @LeftBack(_address; ":"); _address);

SELECT _address = "mysite.com.au"


4. Leave the first column (Hits) as a Totals Column hiding detail rows.

5. The second column should be uncategorized ascending and hidden with a formula of @Year(@Created)

6. The third column should be uncategorized ascending and hidden with a formula of @Month(@Created)

7. The fourth column should display the date. It's best to make this ascending and categorised

Use this formula;

_list := "January" : "February" : "March" : "April" : "May" : "June" : "July" : "August" : "September" : "October" : "November" : "December";

_date := @Date(@Created);
_month := @Month(_date);
_name := _list[_month];

_name + " " + @Text(@Year(_date))

8. The fifth column should be a display values as icons column and should contain the following formula.

REM {the image resource names};
_user := "user";
_system := "system";

REM {check if we got an authenticated user};
_isAuth := @If(AuthenticatedUser != "-"; @True; @False);

REM {display the user icon if we got an authenticated user, else show system icon};
@If(_isAuth; _user; _system)

9. The last column will be the one where you make a lot of changes....
Here are some that I made in mine. You might want to search for specific URL strings and report them as something else or throw in a @replacesubstring to convert %20 to _ but ideally, the aim is to strip off all the leading and trailing junk to leave the unique page information in the URL.

URequest := @UpperCase(Request);

RQ1 := @Right(URequest ; "GET /");

RQ2 := @Left(RQ1 ; "HTTP");

RQ3 := @If(@Contains(RQ2 ; "$FILE"); @Right(RQ2; "$FILE");RQ2);

RQ4 := @If(@Contains(RQ3 ; "?OPENDOCUMENT"); @Left(RQ3; "?OPENDOCUMENT");RQ3);

RQ5 := @If(@Contains(RQ4 ; "WEBPAGEDISPLAY"); @Right(RQ4; "WEBPAGEDISPLAY");RQ4);

RQ6 := @If(@Contains(RQ5 ; "RESOURCELOOKUP"); @Right(RQ5; "RESOURCELOOKUP");RQ5);

RQ7 := @If(@Contains(RQ6 ; "/0/"); "PAGE PREVIEWS" ; RQ6);

RQ8 := @If(@Contains(RQ7 ; "/ALL/"); "SEARCH RESULTS" ; RQ7);

RQ9 := @If(@Contains(RQ8 ; "/SEARCHVIEW"); "SEARCH QUERIES" ; RQ8);

RQ10 := @If(@Contains(RQ9 ; ".GIF"); "GRAPHIC IMAGE" ; RQ9);

RQ11 := @If(@Contains(RQ10 ; ".JPG"); "GRAPHIC IMAGE" ; RQ10);

RQ12 := @If(@Contains(RQ11 ; ".JPEG"); "GRAPHIC IMAGE" ; RQ11);

RQ13 := @If(@Contains(RQ12 ; "?OPENELEMENT"); "GRAPHIC IMAGE" ; RQ12);

LastFix := @Trim(@ReplaceSubstring(RQ13 ; "/" ; ""));

@If(LastFix = ""; "INDEX"; LastFix)


10. Well, that's it really. You can now replace the design of your WebServerLogs and start reporting. To get some neat graphs, try selecting all the pages for the month (the categories, not the invidual pages and copying them as a table).

Paste the table into excel and you can highlight and draw some graphs from them.

No comments: