Riverwatcher Active Content Environment

RACE Documentation:


COUNTER - A simple counter function.



  • FILE - Distinct filename to hold and save the counter value
  • VALUE - Used to set the counter to an arbitrary starting value
  • PEEK - Tells RACE to only fetch the value from the file without incrementing


Example - Simple Hitcounter
Source:

You are visitor #<counter file="mycounter">.

Output:
You are visitor #1.


note: This is the simplest usage of the counter tag. It will count every hit to a page and increment accordingly.


Example - Hitcount-based conditions
Source:
Error: Improperly formatted array or hash.

Output:
This is useful for limiting access to only a certain number of visits. Keep in mind that the counter tag only counts the number of times a page is loaded, not the number of unique visitors loading it.


Example - Tracking only "unique" visitors with cookies
Source:

<if test="<$cookies.visited> != 'yes'">
  <counter file="uniquecount">
</if>
<define cookie="visited" expires="1 year">yes</define>

Output:
This checks to see if a cookie called "visited" is set to "yes" - if not set, then it counts that visit and displays. Then, to make sure the visitor isn't re-counted, the "visited" cookie is set. Keep in mind that this only works with browsers that accept cookies. While it won't give an exact representation of the number of visitors, it should be fairly accurate.




RACE Documentation



 
Copyright 2009 Riverwatcher, Inc. Hosting by Riverwatcher Studios