Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/matomo-org/matomo.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorrobocoder <anthon.pang@gmail.com>2012-04-12 06:18:43 +0400
committerrobocoder <anthon.pang@gmail.com>2012-04-12 06:18:43 +0400
commit8f5d4285bc0388abd842ca0dc36eff7e5c783f5c (patch)
tree5bb34628817f2a27c3d531b7f8db7674c762a1cf /plugins/DoNotTrack
parent1c6444cdb60f0a0e2c1a99d669645250fcc9bb5f (diff)
refs #2048 - add DoNotTrack plugin v0.3
git-svn-id: http://dev.piwik.org/svn/trunk@6201 59fd770c-687e-43c8-a1e3-f5a4ff64c105
Diffstat (limited to 'plugins/DoNotTrack')
-rw-r--r--plugins/DoNotTrack/DoNotTrack.php62
1 files changed, 62 insertions, 0 deletions
diff --git a/plugins/DoNotTrack/DoNotTrack.php b/plugins/DoNotTrack/DoNotTrack.php
new file mode 100644
index 0000000000..b9f7b51d2e
--- /dev/null
+++ b/plugins/DoNotTrack/DoNotTrack.php
@@ -0,0 +1,62 @@
+<?php
+/**
+ * Piwik - Open source web analytics
+ *
+ * @link http://piwik.org
+ * @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
+ * @version $Id$
+ *
+ * @category Piwik_Plugins
+ * @package Piwik_DoNotTrack
+ */
+
+/**
+ * Ignore visits where user agent's request contains either:
+ * - X-Do-Not-Track header (used by AdBlockPlus and NoScript)
+ * - DNT header (used by Mozilla)
+ *
+ * @package Piwik_DoNotTrack
+ */
+class Piwik_DoNotTrack extends Piwik_Plugin
+{
+ /**
+ * Return information about this plugin.
+ *
+ * @see Piwik_Plugin
+ *
+ * @return array
+ */
+ public function getInformation()
+ {
+ return array(
+ 'description' => 'Ignore visits with X-Do-Not-Track or DNT header',
+ 'author' => 'VIP Software Technologies Inc.',
+ 'author_homepage' => 'http://activeanalytics.com/',
+ 'version' => '0.3',
+ 'translationAvailable' => false,
+ 'TrackerPlugin' => true,
+ );
+ }
+
+ public function getListHooksRegistered()
+ {
+ return array(
+ 'Tracker.Visit.isExcluded' => 'checkHeader',
+ );
+ }
+
+ function checkHeader($notification)
+ {
+ $setting = @Piwik_Tracker_Config::getInstance()->Tracker['do_not_track'];
+ if($setting === '1' &&
+ ((isset($_SERVER['HTTP_X_DO_NOT_TRACK']) && $_SERVER['HTTP_X_DO_NOT_TRACK'] === '1') ||
+ (isset($_SERVER['HTTP_DNT']) && $_SERVER['HTTP_DNT'] === '1')))
+ {
+ $exclude =& $notification->getNotificationObject();
+ $exclude = true;
+
+ $trackingCookie = Piwik_Tracker_IgnoreCookie::getTrackingCookie();
+ $trackingCookie->delete();
+ }
+ }
+}