Collecting Stats in Real-time

As described in the Working with Statistics section, the Enterprise Edition of CountryHawk automatically tracks and tabulates statistics on hits by country and region each time the object is created.

Therefore you can add real-time hits by country and region statistics to your web site simply by creating an instance of the CountryHawk object once per each user session. If you are using ASP or ASP.NET, a great place to do this is in the global.asa (global.asax under ASP.NET) onStartPage event.

Example – Automatically add this visitors country and region to running stats count (ActiveX/COM):

set chObj = Server.CreateObject("cyScape.CountryObj")

'the above is the only line of code needed

Example – Automatically add this visitors country and region to running stats count (VB.NET):

<%@ Import Namespace="cyScape.CountryHawk" %>

CountryObj chObj = CountryObj.GetCountry("US")

This will result in this user's matching country and region automatically being incremented by one. For information on how to retrieve and display the collected statistics, see the ch_statsByCountry.asp and ch_statsByRegion.asp sample scripts.

See Also:

Using the CountryStats Object

Using the RegionStats Object

Collecting Stats by Batch Processing Log Files

Persisting Statistics

CountryStats Object and Methods

RegionStats Object and Methods