DEPRECATION WARNING

This documentation is not using the current rendering mechanism and is probably outdated. The extension maintainer should switch to the new system. Details on how to use the rendering mechanism can be found here.

Browser Tutorial Statistics (en)

Author:Kasper Skårhøj
Created:2002-11-01T00:32:00
Changed by:Dirk Wildt
Changed:2012-05-17T05:22:59
Classification:browser_tut_statistics_en
Description:Manage your statistics data with the Browser. The Browser collects hits and vistis for records and files. The statistics data is the basis for displaying the most frequented records or files. A good example are top 10 lists for news, products and records of your own database.
Keywords:forDevelopers, forIntegrators, browser, statistics, tutorial, frontend-engine
Author:Dirk Wildt, Die Netzmacher
Email:http://wildt.at.die-netzmacher.de
Website:http://die-netzmacher.de
Language:en

img-1 img-2 extKey: browser_tut_statistics_en img-3

Browser Tutorial Statistics (en)

Manage your statistics data with the Browser. The Browser collects hits and vistis for records and files. The statistics data is the basis for displaying the most frequented records or files. A good example are top 10 lists for news, products and records of your own database.

img-4

Version: 3.9.14, 2012-05-17 - Version is corresponding with the version of the Browser.

Extension Key: browser_tut_statistics_en - Tutorial for the extension Browser (extkey: browser)

Language: en

Keywords: forDevelopers, forIntegrators, browser, statistics, tutorial, frontend-engine

Copyright 2011-2012, Dirk Wildt, Die Netzmacher, <http://wildt.at.die- netzmacher.de>

This document is published under the Open Content License

available from http://www.opencontent.org/opl.shtml

The content of this document is related to TYPO3

- a GNU/GPL CMS/Framework available from www.typo3.org

Screenshots

Backend

Frame1

You can configure the statistics properties by the Browser plugin (flexform).

Frame1

If a user is calling a record in the TYPO3 frontend, the statistics data will collected in the fields of this the record. Statistics data will be collected in dependence of the selected frontend language.

The tab [Statistics] in a document record of the extension Organiser (org)

Fields for counting hits and visits.

Fields for counting downloaded files (absolute and depending on visits).

Statistics data of the default language record (here: German)

Introduction

What does the Tutorial do?

This is a tutorial for the extension Browser (extkey: browser).

It is only

a tutorial for the Browser statistics

It does explain the workflow of the Browser statistics and documents the needed requirements.

If you are interested in other issues than statistics, please note the section "Further Informations" below.

What does the Browser statistics do?

The Browser statistics enables you to count

  • hits and
  • visits

for

  • records and
  • downloaded files

of every database.

This enables you, to provide the most frequently called records. A common application is a top ten list.

You can configure your statistics by mouse clicks in the Browser flexform (the plugin) and with TypoScript.

The Browser statistics is localised.

The Browser statistics collect only hits and visits per record and per file. It doesn't collect any other data like the IP of the visitor nor any timestamp of a hit or a visit.

What doesn't the Browser statistics do?

The Browser statistics isn't any substitute for web statistics moduls like webalizer or piwik.

Principles

Cache

Views

If the single view of your record is cached by TYPO3 – this is the default –, the Browser statistics module is counting the hit and the visit by the first call only.

Downloads

But downloaded files will counted every time – without any dependency to the TYPO3 cache. It will counted the click on the link for downloading. There will be displayed a dialogue box after the click. The user has the option for cancelling the download. If he cancels the download, this will have any effect for the statistics data. This means exactly:

The clicks will counted, not the real downloads!

Localisation

The Browser statistics module is localised.

Hits and Visits

Hits

Hits are the number of the absolute calls of a record and of a download.

Hits aren't significant, because every visitor can manipulate hits very easy.

If you like to provide top 10 lists, please use the visits as the data basis.

Visits

A visit is a call while the defined period of a visit. The defined period is 30 minutes (1.800 seconds) by default. If a visitor is calling the same record or the the same file for downloading more than once, the statistics module will count only one call.

Visits are significant, because visitors can manipulate visits not very easy.

If you like to provide top 10 lists, please use the visits as the data basis.

Possible misusing

A visit is managed by the TYPO3 session management. If the visitor closes his web browser and starts it again, he will initiate a new session. A call of a record or a download will be a new visit in every case.

Requirements

Data will be stored in statistics fields of the current record.

The needed fields

If you like to use the statistics module, your record should have two fields at least:

  • for counting hits
  • for counting visits

If you provide files for downloading, , your record should have the two fields too:

  • for counting downloads
  • for counting downloads in dependence of visits

Default labels

The Browser uses default labels for the needed fields. It isn't recommended to use own labels, but if you have a database with statistics fields, you can use the given labels too.

The default labels are:

  • for counting hits statistics_hits
  • for counting visits statistics_visits
  • for counting downloads statistics_downloads
  • for counting downloads in dependence of visits statistics_downloads_by_visits

You have to extend your database and the TYPO3 Table-Configuration- Array (TCA). See below.

If you are using different labels, you have to configure the Browser plugin (flexform) or TypoScript.

ext_tables.sql

This is a live example of the extension Organiser (org). The table tx_org_doc is extended with all four fields. It provides files for downloading.

You don't need statistics_downloads and statistics_downloads_by_visits, if you don't provide any file for download.

Please paste and copy the snippet below to the file of your extension: ext_tables.sql

#

# Table structure for table 'tx_org_doc'

#

CREATE TABLE tx_org_doc (

...

statistics_hits int(11) DEFAULT '0' NOT NULL,

statistics_visits int(11) DEFAULT '0' NOT NULL,

statistics_downloads int(11) DEFAULT '0' NOT NULL,

statistics_downloads_by_visits int(11) DEFAULT '0' NOT NULL,

...

);

tca.php

This is a live example of the extension Organiser (org). The table tx_org_doc is extended with all four fields. It provides files for downloading.

You don't need statistics_downloads and statistics_downloads_by_visits, if you don't provide any file for download.

The TCA type

The field types in the snippet below are "none". An editor can't change any data in fields with this type.

You can take another type. Than you have to configure the the field type in the TypoScript too. See "Reference" below.

Code snippet

Please paste and copy the snippet below to the file of your extension: tca.php

$TCA['tx_org_doc'] = array (

...

'columns' => array (

...

'statistics_hits' => array (

'exclude' => $bool_exclude_default,

'label' => 'LLL:EXT:org/locallang_db.xml:tca_phrase.statistics_hits',

'config' => array (

'type' => 'none',

'size' => '10',

),

),

'statistics_visits' => array (

'exclude' => $bool_exclude_default,

'label' => 'LLL:EXT:org/locallang_db.xml:tca_phrase.statistics_visits',

'config' => array (

'type' => 'none',

'size' => '10',

),

),

'statistics_downloads' => array (

'exclude' => $bool_exclude_default,

'label' => 'LLL:EXT:org/locallang_db.xml:tca_phrase.statistics_downloads',

'config' => array (

'type' => 'none',

'size' => '10',

),

),

'statistics_downloads_by_visits' => array (

'exclude' => $bool_exclude_default,

'label' => 'LLL:EXT:org/locallang_db.xml:tca_phrase.statistics_down loads_by_visits',

'config' => array (

'type' => 'none',

'size' => '10',

),

),

...

Configuration

You can configure statistics properties by the Browser flexform (plugin) and by TypoScript.

img-6 3. Illustration: Configuration by the flexform - the Browser plugin

Flexform Please select the Browser plugin, tab [Plugin].

Statistics properties will be configured in the tab [General].

Please enable the statistics module, if you want to use it.If you like to take the TypoScript configuration, enable the TypoScript configuration. Than You have to enable the statistic module in the TypoScript (see below).

Period of a visit in seconds. The default ist 1.800 seconds (30 minutes).If a visitor is calling a record or a file within the period more than one time, it will called only once. If a visitor is calling the same record or file after the period, it will called as a new visit.

You can define a list of remote IPs, which won't be regarded for counting.

Enable the debug report in the frontend. If there is a undefined event while collecting data, there should be a report in the frontend.You can enable logs in the backend. The will have more informative value than the frontend logs.

If you have your own labels for the statistics fields, please configure the field labels.

TypoScript

See "Reference" below.

DRS – Development Reporting System

Check the work flow, get Warning and Errors

If you like to check the work flow, to get the SQL queries, warnings and errors, please enable the DRS, the Development Reporting System.

Condition

You need the extension Developer Log (devlog).

Enable the DRS

Frame1

Admin Tools > Extension Manager

Select the Browser (browser)

Select [Information]. This should be the default

Select "DRS – Development Reporting System" [Statistics]

Get the developer log

Frame1

Clear the TYPO3 Cache

Call the view with your record or download your file in the frontend

Load the developer log:Admin Tools > Developer Log or click [Refresh]

Condition

You need the extension Developer Log (devlog).

Reference

This tutorial provides only the reference for the statistics below (see below).

plugin.tx_browser_pi1

You find all other stuff in the manual of the Browser:

plugin.tx_browser_pi1.flexform.sDEF.statistics

Condition

The TypoScript configuration will have an effect only, if you enable the option"Statistics": [Take the value from TypoScript] in the Browser plugin (flexform).

See the illustration.

Advantage

If your are configure the statistics properties by TypoScript, you will have one big advantage:

Every property is a TypoScript Content Object.

This enables a configuration like:

  • Enable the statistics module only, if a user is logged in.
  • Enable the statistics module only, if the Browser is a firefox.
  • Enable the statistics module only between 8:00 h and 20:00 h.
enabled

Property

enabled

Data type

COA

Description

Disable or enable the statistics module.

Be aware:

The TypoScript configuration will have an effect only, if you enable the option "Statistics": [Take the value from TypoScript] in the Browser plugin (flexform). See above.

Example:

plugin.tx_browser_pi1.flexform.sDEF.statistics {
    // Enable the statistics module
  enabled = TEXT
  enabled {
      // [Boolean] The statistics module is disabled by default
    value = 1
  }
}
adjustment

Property

adjustment

Data type

Array

Description

Every property is a TypoScript Content Object (COA). See more explanation in the comments in the code below.

Example:

plugin.tx_browser_pi1.flexform.sDEF.statistics {
  adjustment {
    fields {
      ... // See description below
    }
      // Period of a visit in seconds
    timeout = TEXT
    timeout {
        // [Integer] Period in seconds. Default is 1800
      value = 1800
    }
      // List of IPs, which won't counted for hits and visits
    dontAccountIPsOfCsvList = TEXT
    dontAccountIPsOfCsvList {
        // [String/csv]
      value = 127.0.0.1, 127.0.0.2
    }
      // Echo a debug report in the frontend
    debugging = TEXT
    debugging {
        // [Boolean]
      value = 0
    }
  }
}
adjustment.fields

Property

adjustment.fields

Data type

Array

Description

Every property is a TypoScript Content Object (COA).

The field type has to be the same type like in the TCA (see "tca.php" above).

See more explanation in the comments in the code below.

Example:

plugin.tx_browser_pi1.flexform.sDEF.statistics {
  adjustment {
    fields {
        // Label and type of the field for counting downloads
      downloads {
          // Label of the field for counting downloads
        label = TEXT
        label {
            // [String] Name of the field in the SQL table.
          value = statistics_downloads
        }
          // Type of the field in the TCA
        type = TEXT
        type {
            // [String] Type of the field in the TCA
          value = none
        }
      }
      downloadsByVisits {
        // The same like downloads above
      }
      hits {
        // The same like downloads above
      }
      visits {
        // The same like downloads above
      }
    }
  }
}

FAQ

Why isn't the statistics enable by default?

If the statistics is enabled, it checks some conditions. It isn't enabled by default, because if you don't need it, you won't have any disadvantage for the performance.

What's happen, if a statistics field is missing?

The Browser statistics module checks, if the needed field for counting is existing. If it isn't existing, no SQL query will executed. This protects from errors.

But in this case there will be logs in the DRS, the Development Reporting System.

What's happen with non localised records?

If you have records, which are localised, and records, which aren't localised, it isn't any matter.

What's happen, depends on your localisation configuration.

If a localised record will displayed, the Browser statistics module will store the hits and visits in the fields of this record.

If there isn't any localised record and the default language record will displayed, the Browser statistics module will store the hits and visits in the fields of the default language record.

If there isn't any localised record and any record will displayed, the Browser statistics module won't count any hits nor visit.

Forum

img-8 7. Illustration: The TYPO3-Frontend-Engine Browser Forum

The Browser has its own forum. We speak English and German. You are welcome to post any question, bug or snippet code at

TYPO3-Frontend-Engine Browser: Forum http://typo3-browser-forum.de/

To-Do List

Nothing to do.

Change Log

3.9.14: Initial release Tutorial

Illustration Index

1. Illustration: Statistics properties in the Browser plugin (flexform) 3

  1. Illustration: Statistics data in the backend form 3
  2. Illustration: Configuration by the flexform - the Browser plugin 8
  3. Illustration: Enable the DRS 9
  4. Illustration: Developer Log 10
  5. Illustration: Take the value from TypoScript 11
  6. Illustration: The TYPO3-Frontend-Engine Browser Forum 14

17