Developers

License

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Release 0.2.0 - 11/08/2009

Release 0.1.4 - 30/07/2009

Store custom data as an associative array so that it can be appended to easily
* Broadcast piwik_plugin.inserting event immediately before inserting tracking code into the request so that listeners can perform any last-minute tracker updates.

tracker_url is where the Piwik server is located. Do not inlcude the protocol prefix (http://).

site_id is the ID of your site in the Piwik installation

Advanced Usage

Module/Action-level Configuration

There are various Piwik attributes that can be set at the module or action level by configuring the
module.yml
file.

all:
sf_piwik_plugin:
params:
# any of the optional params in app.yml can go here
# this configures the entire module
action_name:
sf_piwik_plugin:
params:
# any of the optional params in app.yml can go here
# this configures a specific action within a module

Configurable Parameters

Read the Javascript docs on the Piwik website for further
details on these parameters.

insertion - Position of the tracking code within the HTML <body>. (default=bottom)

custom_data - Any value that will be sent in the data response var. You'd only use this if you've
developed a custom Piwik plugin or are using one that requires this field be set.

document_title - Customize the page name displayed in Piwik.

domains - Consider a host an "alias" host and not record the links to this domain as "outlinks".

download_classes - Set classes to be treated as downloads (in addition to piwik_download).

download_extensions - Set list of file extensions to be recognized as downloads.

ignore_classes - Set classes to be ignored if present in link (in addition to piwik_ignore).

link_classes - Set classes to be treated as outlinks (in addition to piwik_link).

before_tracker_js - Javascript code to be executed immediately before the tracker is invoked.

after_tracker_js - Javascript code to be executed immediately after the tracker is invoked.

force - Forces tracker code to be inserted in the respose even if the request type is "not trackable".
See sfPiwikTracker::isTrackable().

no_init - If true, JS tracker initialization code is not inserted in the response. This is automatically
set to true if the force parameter is on and the current request is XHR.

Accessing the Tracker

At some point, you might want to be able to access the tracker instance from your code to perform some complex
things. Here's how you'd do that:

<?phpclass myActions extends sfActions
{publicfunction executeIndex($request){// get the tracker instance from the context$tracker = sContext::getInstance()->get(sfPiwikTracker::NS);
// you can get or set any of the optional parameters$tracker->setDocumentTitle("My Title");
}}

Tracker Events

Just before the tracker writes the Javascript to the response body, it fires an event to notify listeners of the
last chance to modify tracker parameters. The event fired is piwik_filter.inserting.

Read the Events section from the Symfony guide to
understand how events work.