NeoScript Named Counters



Introduction

NeoScript provides a small collection of functions that implement Named Counters which may be used to track visit activity on a per page or a per page-set or even a per site basis. This document contains descriptions of the current state of the Named Counter feature and functions, as well as indications of our current thinking and suggested improvements, etc.

The rest of this document consists of the following sections:

Please consider this an RFC of sorts and don't hesitate to send your thoughts and suggestions for improvement. Please send comments to Horace at hav@neosoft.com.


Overview

Named Counters is a way to break the cohesion between a page's name and the counter used to track the page's activity. A single Named Counter can be used to track the visits to one page or a collection of pages. Also, a user could actually place several Named Counters on one page: one for the individual page - another used to track a subset of pages - and yet another used to track his/her entire site.

To support the use and storage of Named Counters, a special NeoScript database file called an NCRegistry has been described. Once created, a user's NCRegistry will hold and control all of the user's Named Counters. Users may create their NCRegistry using one of the new NeoScript functions (make_nc_registry). The NCRegistry database must be created (once) before a user can create/register any Named Counters. All NCRegistry databases are named "NCRegistry" and will be located, owned and controlled by the system in a protected directory structure. When creating his/her NCRegistry, the user has the option to specify the maximum number of Named Counters that can be held by the NCRegistry (range 20 ... 200).

All Named Counters must be registered before they can be used. Registering a Named Counter creates the appropriate NCRegistry records. Calls with unregistered counter names are simply ignored. The new NeoScript proc (register_nc) may be used to register a new Named Counter. Once a Named Counter has been registerd, it may be used to track visits by simply including a simple server-side include command in any .html (or .htm) page. There are NeoScript procs to allow calls which increment a counter (incr_nc) or to query a counter's current value (get_nc, get_init_nc, get_real_nc, get_avg_nc). When incrementing a counter, the caller has the option to disable return of the new value.

In addition to counting total visit activity, Named Counters provide several ways to query counts. Activity may be broken down by time period and/or by browser type. Named Counters allow you to ask for the activity since the counter was registered or for a particular day. Named counters also allow you to ask for activity broken down for any of five Browser Classes:

  • mozilla - the total number of mozilla visits (any version)
  • mosaic - the total number of mosaic visits (any maker/version)
  • lynx - the total number of lynx visits (any version)
  • mie - the total number of Micosoft Internet Explorer visits (any version)
  • other - the total number of visits by all other browsers
Restricting the number of browser classes to five keeps disk consumption to a minimum while still providing, at least, some general browser related informationl. By default, all procs return count as the sum of all browser types unless the caller requests only a specific browser class or "other".


Changes Since Last Update

This section is simply a summary of the changes since first presentation. Trivial (verbiage, etc.) changes will not be listed.

  • 3-11-96
    • Added the Changes section to this doc.
    • Added 2 new functions: getncountinit and getncountreal - Tabular Report demo updated to illustrate use

  • 3-17-96
    Major changes. Named Counters are now controled in a single NCRegistry file - rather than in individual files. Addition of the NCRegistry for this purpose. All new (perhaps more consistently named) NeoScript procs to implement the new counter organization. Old counter form still works and the old procs are still in place but will be removed shortly.


Database Files

This section is being completely rewritten for the new NCRegistry organization.


The PROCs

The NeoScript functions which implement NCRegistry creation and, Named Counter registration, incrementation and query comprises 7 simple NeoScript procs:

  • make_nc_registry
  • register_nc
  • incr_nc
  • get_nc
  • get_init_nc
  • get_real_nc
  • get_avg_nc
Each of these procs are described below.


make_nc_registry

This proc is used to create a Named Counter Registry. Each UID may have one such NCRegistry file accessible from NeoScript. Each NCRegistry can hold a minimum of 20 Named Counters. The owner will specify the maximum number of Named Counters allowed as an argument to this proc. No more than 200 Named Counters per NCRegistry will be allowed.

Each NCRegistry has one registry record which maintains a list of the Named Counters in the registry. Record fields are ncmax, nccount, date (quoted), comments (quoted) - also one field for each registered Named Counter (field name as the counter's name and field value is the date on which the counter was registered).

This proc must be called BEFORE any register_nc calls will be honored. You can view the source of an example html page used to create a NCRegistry file.

Calling Sequence:

<!--#neoscript return='make_nc_registry ?ncmax? ?comments?'-->
  • ncmax - maximum number of Named Counters that can be registered in this NCRegistry - default=20 - allowed range is 20 ... 200
  • comments - user comments = default is ""

Operational Notes:

  • if no error message is returned, then creation can be assumed to have been successful.


register_nc

This proc is used to allow users to register Named Counters in the NCRegistry. A counter must be registered (once) before it can be used. You can view the source of an example html page used to register several new Named Counters.

A Named Counter exists within the NCRegistry as a collection of keyed records. There are three record types for each Named Counter in an NCRegistry:

  • init-$cidholds the initial count values for the Named Counter with the name $cid - 1 record per Named Counter - fields: date (quoted), comments (quoted), mozilla, mosaic, lynx, mie, other

  • totals-$cid - holds the current lifetime total counts for the Named Counter - 1 record per Named Counter - fields: total (all browsers), mozilla, mosaic, lynx, mie, other

  • $cid-yyyymmdd - holds the courrent counts for the day (yyyymmdd) for the Named Counter with name $cid - 1 record for every day since the counter was registered - fields: mozilla, mosaic, lynx, mie, other

Calling Sequence:
<!--#neoscript return='register_nc cid ?initcounts? ?comments?'-->
  • cid - is the name of the Named Counter to be registered
  • initcounts - is the initial counts to be assigned to the counter - default=0
  • comments - are user comments to be recorded int the counter's registration record - default="" - stored as quoted string


The remaining procs may be used to increment and/or retrieve named counter values. These are the procs that will be used in most user pages.


incr_nc

increments the Named Counter for the current day (appropriate browser) and the counter's lifetime total (overall and for the appropriate browser).

If this is the first visit of the day, then a new database record is created. Returns, by default the total lifetime visits (all browsers all days) since the counter was registered. The caller may request the daily total instead. The caller may also request only a specific browser's count be returned.

Calling Sequence:

<!--#neoscript return='incr_nc cid ?show? ?browser? ?rtntype?'-->
  • cid - is the name of the counter to be incremented
  • show - is a literal indicator to return or not resurn a count - default is show (any other value means noshow)
  • browser - is the browser count to be returned - default all - allowed values are: all, this, mozilla, mosaic, lynx, mie,other
  • rtntype - is the count to be returned - default lifetime - allowed values lifetime (any other value means today only)


get_nc

This proc is used to retrieve the current visit counts for the counter. By default, it returns the lifetime visit count (total of all days all browsers).

Calling Sequence:

<!--#neoscript return='get_nc cid ?browser? ?rtntype?'-->
  • cid - is the name of the counter to query
  • browser - is the browser count to be returned - default all - allowed values are: all, this, mozilla, mosaic, lynx, mie,other
  • rtntype - is the count to be returned - default lifetime - allowed values lifetime, today or yyymmdd (a date with leading 0 in m & d)

Operational Notes

  • returns -1 if the named counter does not exist


get_init_nc

This proc is used to retrieve the count values assigned to the Named Counter. By default, it returns the total initial count (total of all browsers).

Calling Sequence:

<!--#neoscript return='get_init_nc cid ?browser?'-->
  • cid - is the name of the counter to query
  • browser - is the browser count to be returned - default all - allowed values are: all, this, mozilla, mosaic, lynx, mie,other (a date with leading 0 in m & d)

Operational Notes

  • returns -1 if the named counter does not exist


get_real_nc

This proc is used to retrieve the actual number of visits (not including initial counts assigned). By default, it returns the total initial count (total of all browsers).

Calling Sequence:

<!--#neoscript return='get_real_nc cid ?browser?'-->
  • cid - is the name of the counter to query
  • browser - is the browser count to be returned - default all - allowed values are: all, this, mozilla, mosaic, lynx, mie,other (a date with leading 0 in m & d)

Operational Notes

  • returns -1 if the named counter does not exist


get_avg_nc

This proc is used to retrieve the Average Counts per Day of the Named Counter. By default, it returns the total avg count (all browsers).

Calling Sequence:

<!--#neoscript return='get_avg_nc cid ?browser?'-->
  • cid - is the name of the counter to query
  • browser - is the browser count to be returned - default all - allowed values are: all, this, mozilla, mosaic, lynx, mie,other (a date with leading 0 in m & d)

Operational Notes

  • initial counts are not considered when calculating the avg daily counts
  • returns -1 if the named counter does not exist


Possible Improvements

This is simply a quick list of currently suggested or planned improvements.

  • Done
    Make users register to create a new named counter. This will allow us to keep a record of the counters AND avoid name conflicts. Also, this may be used to allow the user to specify initial counts. Initial counts will be distributed across the browser types as follows...
    Mozilla 85%
    Other 7%
    Mosaic 5%
    Lynx 2%
    MIE 1%

    Registration can be implemented by a simple registration form by which we return the counter name and, perhaps a code snipit to be included in page(s) tracked with the counter.

  • Done as of 3-10-96 - demos are (or will be) updated to include date and comments as well - hav
    add some information to counter registration (initial counts) record. For example:
    • Registration Date
    • Registration Comments - editable

  • related to new registration info - add procs to retrieve registration date and comments.
    Response: No need. Once the info is in the registration record, it can be retrieved via standard and existing NeoScript functionality. - hav

  • Done as of 3-11-96 - tabular report demo updated to illustrate use of new procs - hav
    Add Neoscript functions to get Initial Counts and Real Counts (total - init)

  • generalize to allow more than just five browser types i.e. rework to walk each record's values genericly and add new array elements when a new browser is seen N O T E: Will probably still want to ba able to get all mozilla in addition to all (Mozilla 2.0) etc.

  • add ability to request counts for specified (or current) month or year

  • add ability to request counts for a period (i.e. start & stop day or month or year)

  • add report generation functions (not just single value returns) - for example, might include ratio of mozilla / other
    Response: No need. Once the info is in the registration record, it can be retrieved via standard and existing NeoScript functionality. - for example, take a look at a Graphical display of the example counter's current stats - bars are generated for each browser class' count as a percent of the total counter's count - hav

  • since named counters are controled (more or less) centrally by Neosoft, maybe they could be used to provide daily/monthly/yearly overall statistics (visits not hits). We could include whatever identification information required for reports as part of registration.

Search the Site
Home
http://www.hav.com/
Find Any or All of

http://www.hav.com/
  
Questions?
Feel free to drop by and chat if you have any questions - one of us is usually around during normal CST/CDT business hours.


hav.Software

Copyright © -1995-2012 by hav.Software. All Rights Reserved.

http://www.hav.com/ havBpNet:J, havFmNet:J, havBpNet++, havFmNet++, havBpETT, havCNet, WebSnarfer, havIndex and havChat are all trademarks of hav.Software.

Java and all Java-based marks are trademarks or registered trademarks of Sun Microsystems, Inc. in the U.S. and other countries.

There may be other trademarks or tradenames listed in this document to refer to the entities claiming the marks and names or products. hav.Software disclaims any proprietary interest in any trademark, tradename or products other than its own.


hav@hav.com
Modified - 08/07/99 - 25181003 - 5622032