TraceWatch Website Statistics

The import interface in the administration section lets you do almost any kind of counter data manipulation using an XML file. It can also act as a bridge between TraceWatch and your statistical data in other formats.

All you have to do is to make an XML file with the format described below upload it to the twatch/store folder on your website, Go to Administrate > Import, select the file from the list, click Read File and then click the Import button.

Replacing Current Values with New Values

This method lets you replace any number currently in database with a new value, this operation doesn't change the Counter Availability so you can't add new data to database using this method.

The root of your xml file should be a <data> element. Then you specify your counter with a <counter> tag (for the name of counters see TraceWatch's Administrate > Counters page), then the period with the appropriate tag name and code.

<?xml version="1.0" encoding="UTF-8"?>
<data>
	<counter name="unique visitors">
		<day code="2009-Nov-29">453</day>
		<all>456721</all>
	</counter>
</data>

Above xml file would replace the value of Novemeber 29th 2009 with 453 and the value of All Time with 456721.

You can have as many counters and period as you want in a single XML file.

For list counters instead of just a number you specify a list of rows like this:

<?xml version="1.0" encoding="UTF-8"?>
<data>
	<counter name="pages">
		<day code="2009-Nov-29">
			<row count="85">/</row>
			<row count="32">/products.php</row>
			<row count="22">/contact.php</row>
		</day>
	</counter>
</data>

To figure out how to specify rows and groups for any particular counter first go to Administrate > Counters to see what entity or entities is the counter using, then go to the entities page here to learn the import format.

And for group counters you go like this:

<?xml version="1.0" encoding="UTF-8"?>
<data>
	<counter name="pages">
		<day code="2009-Nov-29">
			<group name="domain: example.com">
				<row count="50">http://www.example.com/</row>
				<row count="30">http://www.example.com/links</row>
			</group>
		</day>
	</counter>
</data>

[IMPORTANT] Replacing list and grouped counters' data replaces the whole list with the new list not just the rows you specified.

Merging Current Data with New Data

With this method you also specify availability start/stop times along with your data.

In this method TraceWatch merges the imported data's availability with your counter's availability and adds the new data to database. If there is full overlap between current availability and imported availability in a certain period, current value will be replaced by imported value. If there is partial overlap within a certain period TraceWatch tries to mix the values.

<?xml version="1.0" encoding="UTF-8"?>
<data>
	<counter name="unique visitors">
		<period type="daily">
			<start>2009-Dec-01 12:00:00</start>
			<stop>2009-Dec-03 10:00:00</stop>
		</period>
		<period type="monthly">
			<start>2009-Dec-01 12:00:00</start>
			<stop>2009-Dec-03 10:00:00</stop>
		</period>
		<day code="2009-Dec-01">40</day>
		<day code="2009-Dec-02">80</day>
		<day code="2009-Dec-03">30</day>
		<month code="2009-Dec">150</month>
	</counter>
</data>

If you specify the availability globally (within the <data> element) it will be copied to all counters.

[IMPORTANT] In this method if you omit a period that is within the availability. TraceWatch gives that period a zero value.

The date-time format is: YYYY-MMM-DD hh:mm:ss. All times are assumed to be in TraceWatch's time zone. Alternatively you can add GMT to the end of a date-time value in which case TraceWatch assumes a UTC/GMT time.

Deleting Data

You can even delete data using the import XML files. All these operations also affect the counter's availability (except those that delete only certain rows or groups).

[IMPORTANT] Be careful when using this feature so that you don't accidentally delete your valuable data.

This is the simplest operation and will delete ALL your counter data:

<?xml version="1.0" encoding="UTF-8"?>
<data>
	<delete />
</data>
		

This will delete all counter data between 2009-Dec-01 12:00:00 and 2009-Dec-03 10:00:00 and between 2009-Dec-05 12:00:00 and 2009-Dec-06 10:00:00:

<?xml version="1.0" encoding="UTF-8"?>
<data>
	<delete>
		<start>2009-Dec-01 12:00:00</start>
		<stop>2009-Dec-03 10:00:00</stop>
		<start>2009-Dec-05 12:00:00</start>
		<stop>2009-Dec-06 10:00:00</stop>
	</delete>
</data>
		

This will delete only the daily data of all counters:

<?xml version="1.0" encoding="UTF-8"?>
<data>
	<delete>
		<period type="daily" />
	</delete>
</data>

This will delete only the daily data of all counters between the times specified:

<?xml version="1.0" encoding="UTF-8"?>
<data>
	<delete>
		<period type="daily">
			<start>2009-Dec-01 12:00:00</start>
			<stop>2009-Dec-03 10:00:00</stop>
		</period>
	</delete>
</data>

This will delete all unique visitors counter data:

<?xml version="1.0" encoding="UTF-8"?>
<data>
	<counter name="unique visitors">
		<delete />
	</counter>
</data>
		

This will delete unique visitors counter data between the times specified:

<?xml version="1.0" encoding="UTF-8"?>
<data>
	<counter name="unique visitors">
		<delete>
			<start>2009-Dec-01 12:00:00</start>
			<stop>2009-Dec-03 10:00:00</stop>
			<start>2009-Dec-05 12:00:00</start>
			<stop>2009-Dec-06 10:00:00</stop>
		</delete>
	</counter>
</data>

You can also specify the period type like the global delete operation.

For list counters you can also delete certain rows:

<?xml version="1.0" encoding="UTF-8"?>
<data>
	<counter name="browsers">
		<delete>
			<row>Internet Explorer</row>
			<row>Firefox</row>
		</delete>
	</counter>
</data>
		

For grouped counters you may delete certain groups:

<?xml version="1.0" encoding="UTF-8"?>
<data>
	<counter name="referrers">
		<delete>
			<group name="domain: example.com" />
		</delete>
	</counter>
</data>

Or certain rows:

<?xml version="1.0" encoding="UTF-8"?>
<data>
	<counter name="referrers">
		<delete>
			<group name="domain: example.com">
				<row>http://www.example.com/something.php</row>
				<row>http://www.example.com/something_else.php</row>
			</group>
		</delete>
	</counter>
</data>
		

For all row and group delete operations you can also specify start/stop times and period type:

<?xml version="1.0" encoding="UTF-8"?>
<data>
	<counter name="browsers">
		<delete>
			<period type="daily">
				<start>2009-Dec-01 12:00:00</start>
				<stop>2009-Dec-03 10:00:00</stop>
			</period>
			<row>Internet Explorer</row>
			<row>Firefox</row>
		</delete>
	</counter>
</data>

Current Version: 0.353

Support TraceWatch Web Stats
Flattr this