![]() |
|
sfPiwikPlugin - 0.3.0Integrate Piwik web analytics into your symfony project. |
|
![]() |
12
users
Sign-in
to change your status |
Integrate Piwik web analytics into your symfony project. |
A Symfony plugin for the Piwik web analytics package.
| Name | Status | |
|---|---|---|
|
|
lead | moc.tcejorp-ynofmys <<ta>> inamar.hsuna |
Copyright (c) 2009 Anush Ramani
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.
| Version | License | API | Released |
|---|---|---|---|
| 1.1.1stable | MIT license | 1.1.0stable | 28/02/2012 |
| 1.1.0stable | MIT license | 1.1.0stable | 24/02/2012 |
| 1.0.5stable | MIT license | 1.0.5stable | 27/09/2010 |
| 1.0.4stable | MIT license | 1.0.4stable | 26/08/2010 |
| 1.0.3stable | MIT license | 1.0.3stable | 25/08/2010 |
| 1.0.1stable | MIT license | 1.0.1stable | 12/03/2010 |
| Version | License | API | Released |
|---|---|---|---|
| 1.0.5stable | MIT license | 1.0.5stable | 27/09/2010 |
| 1.0.4stable | MIT license | 1.0.4stable | 26/08/2010 |
| 1.0.3stable | MIT license | 1.0.3stable | 25/08/2010 |
| 1.0.1stable | MIT license | 1.0.1stable | 12/03/2010 |
| Version | License | API | Released |
|---|---|---|---|
| 1.0.5stable | MIT license | 1.0.5stable | 27/09/2010 |
| 1.0.4stable | MIT license | 1.0.4stable | 26/08/2010 |
| 1.0.3stable | MIT license | 1.0.3stable | 25/08/2010 |
| 0.3.0beta | MIT license | 0.3.0beta | 22/08/2009 |
| 0.2.0beta | MIT license | 0.2.0beta | 11/08/2009 |
| 0.1.4alpha | MIT license | 0.1.4alpha | 30/07/2009 |
| Version | License | API | Released |
|---|---|---|---|
| 0.3.0beta | MIT license | 0.3.0beta | 22/08/2009 |
| 0.2.0beta | MIT license | 0.2.0beta | 11/08/2009 |
| 0.1.4alpha | MIT license | 0.1.4alpha | 30/07/2009 |
piwik_plugin.inserting event immediately before inserting tracking code into the request so that listeners can perform any last-minute tracker updates.A drop-in plugin to add a Piwik tracker to your presentation layer. To use this plugin, you'll need to have a Piwik server installed and running.
Install the plugin
symfony plugin:install sfPiwikPlugin -s=beta
Since the plugin is still in alpha mode, the install requires a -s=beta parameter.
Add the sfPiwikFilter to your filter chain in filters.yml
... # insert your own filters here sf_piwik_plugin: class: sfPiwikFilter ...
Configure your app.yml
all:
sf_piwik_plugin:
enabled: on
tracker_url: example.com/piwik/
site_id: 1
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
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 moduleConfigurable 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).
link_tracking_timer - Set delay for link tracking in milliseconds.
enable_link_tracking - Install link tracking on all applicable link elements. (default=on)
campaign_name - Set a campaign name.
campaign_keyword - Set a campaign keyword.
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:
<?php class myActions extends sfActions { public function executeIndex($request) { // get the tracker instance from the context $tracker = sContext::getInstance()->get(sfPiwikTracker::NAMESPACE); // 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.
