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.

EXT: B-Net1 Piwik

Author:Kasper Skårhøj
Created:2002-11-01T00:32:00
Changed by:Jörg Winter
Changed:2009-10-06T13:53:09
Author:Jörg Winter
Email:winter@b-net1.de
Info 2:Ulrich Wünsche
Info 3:
Info 4:

EXT: B-Net1 Piwik

Extension Key: bn1_piwik

Copyright 2009, Jörg Winter, <winter@b-net1.de>

Please report all bugs and feature request at `http://dev.b-net1.de/ <http://dev.b-net1.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.com

Table of Contents

EXT: B-Net1 Piwik 1

Introduction 1

What does it do? 1

Features 1

Users manual 2

Configuration 2

Required parameters 2

Configuration Options 3

TypoScript Examples 3

Known problems 4

To-Do list 4

Changelog 4

Introduction

The extension implements Piwik tracking in TYPO3-based websites.

Piwik is a new open source (GPL license) web analytics product. It gives interesting reports on your website visitors, your popular pages, the search engines keywords they used, the language they speak… and so much more. To learn more about Piwik, go to http://www.piwik.org .

This extension is a reimplementation of m1_google_analytics, but for Piwik. It uses documentation and some code resemblance from Frank Naegler's original Piwik extension and from Ulrich Wünsche's Piwika2 extension.

img-1

What does it do?

The extension inserts the javascript-code used for tracking website users with Piwik, into the end of the body-tag.

Features

  • Implements the Javascript Tracking Code for the New Piwik Javascript Tracking API that commes with Piwik 0.4
  • The following Piwik Tracking Functions can be configured with Typoscript.
    • piwikTracker.setDocumentTitle()
    • piwikTracker.trackGoal()
    • piwikTracker.setDomains()
    • piwikTracker.enableLinkTracking()
    • piwikTracker.setIgnoreClasses()
    • piwikTracker.setDownloadClasses()
    • piwikTracker.setLinkClasses()
    • piwikTracker.setLinkTrackingTimer()
    • piwikTracker.setDownloadExtensions()
    • piwikTracker.addDownloadExtensions()
  • If You are logged in as a BE-User your FE-Hits will not be tracked.

Users manual

To install Piwik on your website follow these steps:

Install Piwik and create your Piwik account, for more information see http://piwik.org/

To enable Piwik tracking in your website, we need to know your site ID and hostname of the piwik installation.

Install the plugin from TYPO3 online repository and enable it

Add this configuration options to your template (both parameters are required):

config.tx_bn1piwik {
  piwik_idsite = (your site id)
  piwik_host   = (host/path of your piwik installation without URL-scheme)
}

That's all you need to start tracking your visitors. See “Configuration” section for more config options and description of the parameters.

Configuration

All configuration parameters for this extension should be in your template TypoScript, inside the config.tx_bn1piwik container. Please see the option descriptions below.

Required parameters

Defines your Piwik site id and host/path to your piwik installation. This parameter needs to be set for the extension to work. If your Sites ID is 3 and the path your piwik installation is stats.myhost.rl/piwik/piwik.php, your TypoScript in the template should look like:

config.tx_bn1piwik {
      piwik_idsite = 3
        piwik_host   = stats.myhost.rl/piwik/
}

Once you set up this parameter, you can check if everything worked correctly by looking at your pages HTML source. The piece of code that drives Piwik is inserted right before the closing tag of <body> container:

<!-- Start B-Net1 Piwik Tag 
<script language="javascript" src="http://stats.myhost.rl/piwik/piwik.js" type="text/javascript"></script>
<script type="text/javascript">
<!--
try {
var piwikTracker = Piwik.getTracker("http://stats.myhost.rl/piwik/piwik.php", 3);
piwikTracker.enableLinkTracking();
piwikTracker.trackPageView();
} catch( err ) {}
//-->
</script>
<noscript>
<p><img src="http://stats.myhost.rl/piwik/piwik.php?idsite=3" style="border:0" alt="piwik"/></p>
</noscript>
<!-- End B-Net1 Piwik Tag 
</body>

Configuration Options

The following table shows you all configuration options for the Piwik JavaScript API. All these parameters you have to set in your TypoScript Template like the required parameters piwik_idsite and piwik_host.

piwik_idsite

Property

piwik_idsite

Data type

string

Description

The id of your Piwik account

Default

piwik_host

Property

piwik_host

Data type

string

Description

The host / path to your piwik installation without URL-scheme

Default

actionName

Property

actionName

Data type

string / stdWrap

Description

This parameter controll the action name, which will be tracked by Piwik. This parameter has one special keyword:

“TYPO3” this means, that the page title will be used for this parameter.

All other values will be rendered directly to this JavaScript variable. If you want to use other JavaScript objects like document.title you can do so. If you want to overwrite the parameter with an static string, like from TS, you have to quote the value with single quotes.

This extension will not quote the value of this parameter.

Default

Empty string

trackGoal

Property

trackGoal

Data type

int

Description

ID of the goal to be triggered

Default

setDownloadExtensions

Property

setDownloadExtensions

Data type

string

Description

A list of file extensions, divided by a pipe symbol (|).

Default

7z\|aac\|avi\|csv\|doc\|exe\|flv\|gif\|gz\|jpe?g\|js\|mp(3\|4\| e?g)\|mov\|pdf\|phps\|png\|ppt\|rar\|sit\|tar\|torrent\|txt\|wma\|wmv\ |xls\|xml\|zip

addDownloadExtensions

Property

addDownloadExtensions

Data type

string

Description

A list of file extensions, divided by a pipe symbol (|).

Default

7z\|aac\|avi\|csv\|doc\|exe\|flv\|gif\|gz\|jpe?g\|js\|mp(3\|4\| e?g)\|mov\|pdf\|phps\|png\|ppt\|rar\|sit\|tar\|torrent\|txt\|wma\|wmv\ |xls\|xml\|zip

setDomains

Property

setDomains

Data type

string / list

Description

A comma separated list of host aliases for your site.

By default all links to domains other than the current domain are considered outlinks. If you have multiple domains and don’t want to consider links to these websites as “outlinks” you can add this new javascript variable.

Default

setLinkTrackingTimer

Property

setLinkTrackingTimer

Data type

int

Description

When a user clicks to download a file, or when he clicks on an outbound link, Piwik records it: it adds a small delay before the user is redirected to the requested file or link. We use a default value of 500ms, but you can set it shorter, with the risk that this time is not long enough to record the data in Piwik.

Default

500

enableLinkTracking

Property

enableLinkTracking

Data type

boolean

Description

To disable all the automatic downloads and outlinks tracking, you must set this parameter to 0

Default

1

setIgnoreClasses

Property

setIgnoreClasses

Data type

string

Description

You can disable automatic download and outlink tracking for links with this CSS classes.

Default

setDownloadClasses

Property

setDownloadClasses

Data type

string

Description

If you want Piwik to consider a given link as a download, you can add the 'piwik_download' css class to the link.

With this parameter you can customize and rename the CSS class used to force a click to being recorded as a download

Default

setLinkClasses

Property

setLinkClasses

Data type

string

Description

If you want Piwik to consider a given link as an outlink (links to the current domain or to one of the alias domains), you can add the 'piwik_link' css class to the link.

With this parameter you can customize and rename the CSS class used to force a click to being recorded as an outlink.

Default

[TS-Setup: config.tx_bn1piwik]

TypoScript Examples

Using the stdWrap feature of the “actionName” property, to build a actionName hierarchy like a rootline navigation.

config.tx_bn1piwik {
             piwik_idsite = 3
             piwik_host   = stats.myhost.rl/piwik/
             actionName= TYPO3
             actionName {
                     stdWrap {
                             cObject = HMENU
                             cObject {
                                     special=rootline
                                     special.range= 1 | -1
                                     includeNotInMenu = 1
                                     wrap = |/index
                                     1=TMENU
                                     1.itemArrayProcFunc = user_UrteileItemArrayProcFunc
                                     1.NO.allWrap=  |   /   |*| |   /   |*| |
                                     1.NO.doNotLinkIt = 1
                             }
                     }
             }
     }

Known problems

The function to prevent FE-Pagehits from tracking for logged in BE- Users will only work if FE and BE are on the same Domain.

To-Do list

  • Function to register a conversion for a goal with a custom Revenue .
  • Function to send custom JSON data to the piwik.php tracking scripts.

Changelog

2.1.0: added stdWrap functionality to “actionName” property

2.0.2: fix problem with not processing setIgnoreClasses, setDownloadClasses and setLinkClasses typoscript parameters

2.0.1: fix errors with typoscript parameter and wrong javascript

2.0.0: first beta release

img-2 EXT: B-Net1 Piwik - 4