MetaTraffic v1.301

by Metasun Software

Table Of Contents

  1. Licensing
  2. Overview
  3. Zip Contents
  4. Version History
  5. Requirements
  6. Installation
  7. Upgrading From Previous Versions
  8. Configuration
  9. Troubleshooting Common Problems
  10. Security Considerations
  11. Known Limitations
  12. Support


MetaTraffic is not freeware. Please make sure you read our license agreement in detail included in the zip file. You can also check out a summary of this agreement on Metasun's website.



MetaTraffic is a web site statistics application developed in pure ASP. It now supports the following features:

See Metasun's web site for full details.


Zip Contents

File Name Description
auth.asp Checks to see if the user is authenticated (if security is enabled)
calendar.asp Calendar popup for selecting dates for reports
calendar.gif Calendar image used to popup the calendar date picker
class.asp Contains the metatraffic class that does all the work including logging and report generation. All of the application logic is in this file.
config.asp Configuration file that contains all the program's settings
db.mdb MS Access database
default.asp Page that generates the reports
help.htm Help file
info.gif Small graphic for displaying more information in reports
license.txt MetaTraffic software license agreement
link.gif Plus sign graphic used in the Referring Urls report
login.asp Login page that authenticates users to access the report generator
metatraffic.gif MetaTraffic logo
metatraffic.sql SQL Script for creating table in SQL Server database
readme.htm This file
setup.asp Setup page for MetaTraffic database options
spacer.gif Transparant image used to create the graphs
track.asp Tracking script that is called to log activity to the database
track.htm Javascript to include in HTML pages that support server side includes.
track.js Javascript file to include in HTML pages that do not support server side includes.
upgrade.asp Script to upgrade database from versions prior to v1.200

Total: 21 files


Version History

v1.301 - Oct 7th, 2003

v1.300 - July 23rd, 2003

v1.200 - June 16th, 2003

v0.993 - Feb 3rd, 2003

v0.992 - Jan 14th, 2003

v0.991 - Jan 7th, 2003

v0.990 - Jan 4th, 2003

v0.970 - Dec 22nd, 2002

v0.950 - Dec 9th, 2002

v0.900 - Nov 13th, 2002

v0.861 - Nov 8th, 2002

v0.860 - Nov 6th, 2002

v0.850 - Oct 28th, 2002

v0.801 - Oct 7th, 2002

v0.800 - Oct 2nd, 2002



Mandatory Server Requirements



Optional Server Requirements

Client Requirements



Installation of MetaTraffic is simple. First, you need to install the report generator. Once this is working on your web site, you need to add a snippet of HTML or ASP code to all of your web pages which tracks the activity. This is discussed in more detail below.

Installing the Report Generator

  1. Extract the contents of the zip file into a folder called metatraffic
  2. Modify config.asp as nessasary (see Configuration for details)
  3. Upload the folder to your web site

Most installations that use MS Access as the database will not require any modification to config.asp if you follow the instructions above. You should still read the configuration options to ensure that reports are displaying the way you want them to.

Setting Up SQL Server

If you would like to use SQL Server as your database, you will need to run the metatraffic.sql file using SQL Server Query Analyzer. This will create the table nessasary for logging and reporting web activity. Once the table is created, create a user or use an existing SQL Server login account that has datareader/datawriter priviledges on that database. Do not use the SA account other than for testing purposes or upgrading the database. Make sure that the config.asp has the proper database settings configured such as specifying the username and password that has the correct privilidges on the database.

Logging Methods Overview

There are three different methods of logging. The following table lists the various types of logging methods including a description of each. The ideal logging method depends on how your web site is setup. All logging methods require you to add a snippet of ASP or HTML code to your web pages depending on the type of logging you choose to use. Examples are shown below the table.

Logging Method Common Uses Description
ASP Track ASP pages (.asp)

Use this method to track your ASP pages by including a snippet of ASP code in your pages. The benefits of using this logging type is that most ASP web applications have a common include that you can simply add a snippet of code and track your entire site. Also, this is the only logging method that will track robots that access your site. The disadvantage of solely using this logging method is that no screen area data is generated as this requires the use of the javascript logging method.

Javascript Track HTML pages (.htm, .html, etc.) This logging method uses javascript executed on the client's web browser. This is the only way to track non-ASP web pages including .html, .cfm, .shtml, .php, .aspx, etc. The downside of using this logging method is that web clients that have disabled javascript in their browser or don't support javascript will not be logged. This includes robots. However, this is the only way to track screen area (resolution) data.

Note: When using this tracking method, there is a configuration option in the track.htm file called scriptlocation. This must be set to the file location of track.asp or the javascript logging method will not work.

Redirect Track other files (.exe, .zip, etc.) The redirect logging method is the only way to track downloads, media files such as audio and video and other non-ASP or HTML based files. This is done by calling the track.asp in a link in your web pages that includes a querystring variable that tells the tracking script where to redirect the user after it has logged the request. (See example below)

Setting Up Tracking


To track your .ASP files, add the following code to any .ASP page that you want to track:

<% Server.Execute("/metatraffic/track.asp") %>

You can also use a standard include in your asp pages like this:

<!-- #include virtual="/metatraffic/track.asp" -->

It is preferable to use the Server.Execute method, specifically if you have ASP script in your pages as it will run independantly of those scripts preventing re-use of variables, etc. The obove logging method will only work in ASP pages as it executes the tracking ASP code directly.


To track an html file that supports server side includes, add the following line of code to your html document:

<!-- #include virtual="/metatraffic/track.htm" -->

Important Note: You can configure IIS to support server side includes for any file extension. However, by default, IIS only supports server side includes for files with the extensions .shtm, .shtml, .stm, and .asp. To learn more about server side includes and how to allow other extensions such as .htm and .html to support them, read this Microsoft TechNet article.


If your html files do not support server side includes, you have two options. You can include the track.js javascript file in your pages by placing the following HTML code somewhere in your page:

<SCRIPT LANGUAGE="JavaScript" SRC="/metatraffic/track.js"></SCRIPT>

You can also copy and paste the code from track.htm file into your web pages.

Important Note: If you installed metatraffic into a folder other than the default, you will also have to modify the scriptlocation variable in track.js or track.htm to point to the correct location of the track.asp file. Do not use more than one of the tracking options shown above in the same page. Doing this will cause multiple entries to be logged in the database and cause incorrect reporting behaviour.


You can also track files that aren't web pages by linking to them in your web page with HTML. This is useful for tracking downloads, media files, etc. The link would look like this:

<a href="/metatraffic/track.asp?r=/downloads/">Download</a>

This would track downloads of that existed in a virtual directory called downloads. Once track.asp logs the activity, the user is redirected to whatever file you specify. The querystring variable "r" expects some file location to be passed to it. This can be a virtual file path as shown above, an absolute path or a fully qualified URL such as MetaTraffic will not log the domain information (only the file path) so this cannot be used to track outbound traffic as it will not show the domain information in any report.

It is recommended that you use a virtual path when specifying paths as in all the examples above.



MetaTraffic has a configuration file called config.asp containing several program variables. By updating the file with different values, you can control several things in MetaTraffic. (All of the settings below are located in config.asp except scriptlocation which is located inside track.js file.)

Name Variable Value Default Description
Instance strInstance 0 - 10 characters Empty Used for running multiple instances of MetaTraffic on the same SQL Server database.
Username strUsername 0 - 20 characters Empty Username for securing the report generator. Leave this string empty to disable username protection.
Password strPassword 0 - 20 characters Empty Password for securing the report generator.
Site Aliases strSiteAliases Host names separated by commas Empty A list of host names used to access the web site that should be excluded from the referrer reports.
Exclude IP Addresses From Log strExcludeIPFromLog IP Addresses separated by commas Empty A list of IP Addresses that you do not want to log traffic for. Supports wildcard character of * for class B and C IP address blocks. (Example: 10.0.*.* and 10.0.0.*)
Analyze Data intAnalyzeData 0 - 3 1

Controls when data analysis occurs to calculate referrer data, robots, browsers, languages, etc.

0 - Never (Not Recommended)
1 - When Logging (Default)
2 - When Generating Report
3 - Both (Logging and Report Generation)
Show Graph blnShowGraph True or False True Turn graphing on or off.
Session Duration intSessionDuration Integer 60 The number of minutes that a session is considered active and will show up in the Who's Online report for.
Exclude Robots blnExcludeRobots True or False False Remove known robots from most reports including summaries. Does not affect robots or user agents reports.
Log blnLog True or False True Turn logging on or off. Useful to temporarily disable logging.
Report Chooser Size intReportChooserSize 1-23 10 Controls the size of the select box for choosing the type of report. Setting this to 1 makes it a drop down menu.
Delete After Days intDeleteAfterDays 0 or Greater 0 Delete records in the database after the specified number of days. Records will never be deleted when set to zero. This setting relies on logging being enabled. Records are deleted on the fly as pages are logged. Thus if there is no activity, no records will be deleted despite the records being older than the specified number. This setting is experimental.
Database Type strDatabaseType MSACCESS or MSSQL MSACCESS Type of database to use. MS Access or SQL Server 7 / 2000 are supported.
Database Name strDatabaseName String Value Empty Name of the database. If database type is MSACCESS, then this is the filename of the database (example: db.mdb). If database type is MSSQL, then this is the name of the database.
Database Location strDatabaseLocation String Value Empty Location of the database being used. If database type is MSACCESS, this is the file path of the database. The file path can be a virtual path (example: /metatraffic), a file path (example: c:\inetpub\databases) or just a relative path (example: metatraffic). There should be no trailing slash. If the database type is MSSQL, then this is the server name or address of the database server (example: databaseserver or
Database Username strDatabaseUsername String Value Empty The username with permissions on your database. If you are using MSACCESS as your database type, you can leave this blank. If you are using MSSQL, then this should be set to an account that has datareader / datawriter permissions on the database. It is not recommended that you use the SA or other account with DBO permissions other than upgrading the database.
Database Password strDatabasePassword String Value Empty The corresponding database password for the username specified above.
Locale Session.LCID Integer Empty To control the date formats of the calendar and reports, set the locale to your local location. For a complete list of LCIDs, have a look at Microsoft's MSDN Locale ID Chart. (When looking at the chart, the integer column is the value that needs to used for this setting.)
Script Location scriptlocation String Value Empty The scriptlocation variable is located in track.htm and track.js files. This needs to set to the exact file path of the ASP tracking script (track.asp). This only needs to be configured if you are using the javascript tracking method.

Upgrading From Previous Versions

To upgrade from a previous version, please ensure that you read each version change and follow the instructions. NOTE: ALWAYS MAKE SURE YOU BACKUP YOUR DATABASE AND FILES BEFORE UPGRADING!

v1.300 --> v1.301

Update the following file(s):

v0.993 and v1.2 (including Beta versions) --> v1.301

Extract the MetaTraffic v1.3 files to a folder on your hard drive. Update the new config.asp file with your existing configuration. Disable logging temporarily by setting the blnConfig configuration option to False. Upload all the files to your web server except metatraffic.sql and db.mdb.


If you are running SQL Server, change the database username and password to the SA account (or another account that has DBO permissions on the database) in the config.asp file. Make sure you change your database username / password back to a non-SA account once you have finished upgrading the database.


Run the upgrade.asp file to upgrade your database. Follow steps one and two in order to update your database schema and data respectively. NOTE: Make sure you have the strSiteAliases configured correctly before updating your data in step 2. Doing so will significantly optimize the database by removing unnessasary data and result in a smaller database.

Delete the upgrade.asp file from your web server when the upgrade is complete.

If you are running MS Access, you should compact and repair the database now. This can be done on the setup.asp page.

Finally, re-enable logging by setting the blnLog configuration option to True in the config.asp file.

v0.992 --> v0.993

Update the following file(s):

v0.991 --> v0.992

Update the following file(s):

v0.990 --> v0.991

Update the following file(s):

If you are running a version prior to v0.990, you will need to contact Metasun for support on how to upgrade. Please include your version number.

Troubleshooting Common Problems

The most common problem that occurs when setting up MetaTraffic with an MS Access database is an error that says: "Operation must use an updateable query." This is caused by the Internet Guest account (IUSR_MACHINE) not having write permissions on the database file (db.mdb). Please read this Microsoft Knowledge Base Article for more information.

If your Screen Area report says "There is no data to display.", this could be because you are not using the javascript logging method; this is the only way to capture client resolution data.

If you are having difficulty getting the javascript logging method to track page requests, it could be caused by not having the scriptlocation variable configured correctly in the track.htm file. Make sure this points to the correct file location of the track.asp file.

If you are using the javascript logging method, it can be difficult to diagnose problems because you will not usually see any error messages in your browser. Once you have MetaTraffic installed and configured, try loading the track.asp page in your web browser to generate an entry in the database. If there are any errors, it will also show you what they are. If you are using Internet Explorer, make sure you have "Show Friendly Error Messages" unchecked. This can be found in your Internet Settings under the advanced tab.


Security Considerations

If you are using MS Access as your database, it is not a good idea to have it in a publicly accessible folder such as in your web site content directory. It is recommended that you move it to a folder on your server that is not accessible via your web site. However, the Internet Guest account (IUSR_MACHINE) of your web server must have read and write permissions on the database file.


Known Limitations

It is not recommended that you change the intAnalyzeData variable from the default. This is there for debugging purposes only. Changing this option from the default can cause odd reporting behavior and slow generation of reports.

When you track pages using the javascript method, there will be no robot data collected. This is because the robots will not execute the javascript and never log anything to the database.

When you track pages using the ASP method, Screen Area data is not collected. Javascript tracking is required to capture client resolution information.



If you require support, please visit our support site.