User login

MetaTraffic 2.0 Boxshot

Exclude visits by myself

Posted by segoer [July 24, 2003]

Before switching to Metatraffic, I used to use another cgi tracking system which has a feature that excludes visits by myself by storing a cookie in my computer. Can I have that also in Metatraffic?

Exclude visits by myself

quote:Originally posted by segoer
Before switching to Metatraffic, I used to use another cgi tracking system which has a feature that excludes visits by myself by storing a cookie in my computer. Can I have that also in Metatraffic?

At this moment, MetaTraffic can excludes visits based on the IP address. Since most of our IP addresses are dynamic, this is rather impossible to maintain that exclusion list dynamically up to date.

Using a cookie seems to be an appropriate way to do it. If you know a bit of VBScript, this can easily be done and added to the package.

Even if the cookie feature can be added easily, we must ensure that this exclusion method can be enabled/disabled easily, mainly to allow testing prior to promote the updated scripts to "production".

Regards.

Indicate which version of MT you're using, this will help the other people using the same version as you to provide you with more precise details for the implementation.

I think I'll add this option to my environement, sounds like a simple and usefull add-on.

Exclude visits by myself

Hi, Daniel,

I'm using MT 1.3 right now. Unfortunately I'm not quite at home with scripting so if you can share your work with us, I'd be very much grateful.:)

Exclude visits by myself

Good day,

Here's a "quick and dirty" way to do it. I'm saying quick and dirty simply because it doesn't have bells and whistles! :D

Step 1:

Add the variable "blnExcludeMe" in one of the existing DIM statements at the top of the "config.asp" file, or create a new line as follow :
[code]
Dim blnExcludeMe
[/code]
Step 2:
Going down in the "config.asp" file, you will find a line showing the following :
[code]
strExcludeIPFromLog = ""
[/code]
Right after that line add this : (Pay attention to the line wrapping).
[code]
blnExcludeMe=True
'
' Add local current station address to the exclusion list, if appropriate
'
If ((blnExcludeMe=True) And (Request.Cookies("metasunmt")("ExcludeMe")="Y")) Then
If (strExcludeIPFromLog="") Then
strExcludeIPFromLog=Request.ServerVariables("REMOTE_ADDR")
Else
strExcludeIPFromLog=strExcludeIPFromLog & "," & Request.ServerVariables("REMOTE_ADDR")
End If
End If
[/code]
Close and save the "config.asp" file.

Last step, create a page named "excludeme.asp" using the code below. Once again, pay a close attention to the line wrapping :
[code]
<%@ Language=VBScript%>
<%Response.Buffer = True%>

<%
Dim ExclLog
Select Case Request.QueryString("ExcludeMe")
Case "Y"
Response.Cookies("metasunmt")("ExcludeMe")="Y"
Response.Cookies("metasunmt").expires = dateadd("yyyy", 1, date())

If (blnExcludeMe=True) Then
ExclLog="Current computer will be dynamically added to the tracker exclusion list whenever appropriate."
Else
ExclLog="Current computer will NOT be dynamically added to the tracker exclusion list." &_
"Inclusion will be performed ONLY when the 'blnExcludeMe' flag will be set in 'config.asp'."
End If
Case "N"
Response.Cookies("metasunmt")("ExcludeMe")="N"
Response.Cookies("metasunmt").expires = dateadd("yyyy", 1, date())
ExclLog="Current computer will NOT be dynamically added to the tracker exclusion list." &_
"It will be logged as any other regular user."
Case Else
If (Request.Cookies("metasunmt")("ExcludeMe")="") Then
ExclLog="Current computer will be logged as any other regular user as there are no cookies set."
Else
If (Request.Cookies("metasunmt")("ExcludeMe")="Y") Then
ExclLog="Current computer will be dynamically added to the tracker exclusion list whenever appropriate."
Else
ExclLog="Current computer will NOT be dynamically added to the tracker exclusion list."
End If
End If
End Select
%>

MetaTraffic - Settings for log exclusion

Click ?ExcludeMe=Y">Here to prevent MetaTraffic from logging your computer activities.

 

Click ?ExcludeMe=N">Here allowing MetaTraffic to log your computer activities.

 

<%=ExclLog%>

 

Copyright ©2003, Metasun Software

[/code]
Upload your updated "config.asp" file and the "excludeme.asp" file you just created. They should be store in the same directory.

With your browser, go to the page you just created. There will be 2 links. The first one, will set a cooking preventing MetaTraffic from logging your accesses to the site. The second one, is doing the reverse, thus allowing Metatraffic to log the access, as it would normally do with all the other users.

If the line you added "blnExcludeMe=True", is changed to "blnExcludeMe=False", MetaTraffic will log the accesses regardless of the cookie settings. The idea behind it is as follow. Like the "upgrade.asp" page, the "excludeme.asp" should be considered as a one shot deal, therefore be removed from the site, unless you know for sure nobody will attempt to access it, and hide their accesses.

So by enabling/disabling the cookie validation via the config file, will prevent you from having to re-upload "excludeme.asp" only to set the cookie temporarely for testing.

The life of the cookies was set to 1 year after the time the link is clicked on.

I guess that should do it.

Please note that I did it in a similar fashion on my site, although I'm not using "excludeme.asp". I integrated the logic in the "setup.asp" page, which is visible only to the users having administration level on my site. Regular users can't "mess" with it, as it is part of the administration section.

Have fun! ;)

Exclude visits by myself

Great work, Daniel! I'll put it up on my website right away. Now my own private Metatraffic is one step nearer to perfect. I hope this will be incorporated in MT in its next release too.

Thanks for the script and the detailed instructions.