Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F9785805
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Size
4 KB
Referenced Files
None
Subscribers
None
View Options
diff --git a/plugins/piwik_analytics/config.inc.php.dist b/plugins/piwik_analytics/config.inc.php.dist
new file mode 100644
index 00000000..7397e8f6
--- /dev/null
+++ b/plugins/piwik_analytics/config.inc.php.dist
@@ -0,0 +1,44 @@
+<?php
+ /* piwik site id */
+ $rcmail_config['piwik_analytics_id'] = 4;
+
+ /* domain of your piwik installation */
+ $rcmail_config['piwik_analytics_url'] = 'noc.kolabsys.com/piwik/';
+
+ /* exclude private pages - analytics will works only for non-logged users */
+ $rcmail_config['piwik_analytics_privacy'] = false;
+
+ /* exclude the following templates */
+ $rcmail_config['piwik_analytics_exclude'] = Array(
+ );
+
+ // Possible templates:
+
+// "message",
+// "messagepreview",
+// "compose",
+// "editidentity",
+// "editcontact",
+// "showcontact"
+
+ // "message",
+ // "messagepart",
+ // "messagepreview",
+ // "messageerror",
+ // "showcontact",
+ // "addcontact",
+ // "editcontact",
+ // "importcontacts",
+ // "addressbook",
+ // "compose",
+ // "editidentity",
+ // "error",
+ // "identities",
+ // "login",
+ // "mail",
+ // "managefolders",
+ // "plugin",
+ // "settingsedit",
+ // "settings"
+
+?>
\ No newline at end of file
diff --git a/plugins/piwik_analytics/piwik_analytics.php b/plugins/piwik_analytics/piwik_analytics.php
new file mode 100644
index 00000000..27a2603f
--- /dev/null
+++ b/plugins/piwik_analytics/piwik_analytics.php
@@ -0,0 +1,83 @@
+<?php
+
+/**
+ *
+ * piwik_analytics
+ *
+ * Bind piwik analytics script - based on: http://github.com/igloonet/roundcube_google_analytics
+ *
+ * @version 1.0 - 28. 11. 2010
+ * @author Florian Beer
+ * @modified_by Florian Beer
+ * @website http://blog.no-panic.at
+ * @licence GNU GPL
+ *
+ * Updated by Jeroen van Meeuwen (Kolab Systems) <vanmeeuwen@kolabsys.com>
+ *
+ **/
+
+class piwik_analytics extends rcube_plugin
+{
+ function init()
+ {
+ if (file_exists(dirname(__FILE__) . "/config.inc.php")) {
+ $this->load_config('config.inc.php');
+ } elseif (file_exists(dirname(__FILE__) . "/config.inc.php.dist")) {
+ $this->load_config('config.inc.php.dist');
+ } elseif (file_exists(dirname(__FILE__) . "/config/config.inc.php")) {
+ $this->load_config('config/config.inc.php');
+ } elseif (file_exists(dirname(__FILE__) . "/config/config.inc.php.dist")) {
+ $this->load_config('config/config.inc.php.dist');
+ /* } else {
+ error_log("Cannot find / load configuration for plugin piwik_analytics"); */
+ }
+
+ $this->add_hook('render_page', array($this, 'add_script'));
+ }
+
+ function add_script($args) {
+ $rcmail = rcmail::get_instance();
+
+ $exclude = $rcmail->config->get('piwik_analytics_exclude');
+
+ if (empty($exclude) || !is_array($exclude)) {
+ $exclude = Array();
+ }
+
+ if (isset($exclude[$args['template']])) {
+ return $args;
+ }
+
+ if ($rcmail->config->get('piwik_analytics_privacy', true)) {
+ if (!empty($_SESSION['user_id'])) {
+ return $args;
+ }
+ }
+
+ if (!$rcmail->config->get('piwik_analytics_url', false)) {
+ return $args;
+ }
+
+ $script = '
+<!-- Piwik -->
+<script type="text/javascript">
+ var pkBaseURL = (("https:" == document.location.protocol) ? "https://' . $rcmail->config->get('piwik_analytics_url') . '" : "http://' . $rcmail->config->get('piwik_analytics_url') . '");
+ document.write(unescape("%3Cscript src=\'" + pkBaseURL + "piwik.js\' type=\'text/javascript\'%3E%3C/script%3E"));
+</script>
+<script type="text/javascript">
+ try {
+ var piwikTracker = Piwik.getTracker(pkBaseURL + "piwik.php", ' . $rcmail->config->get('piwik_analytics_id') . ');
+ piwikTracker.trackPageView();
+ piwikTracker.enableLinkTracking();
+ } catch( err ) {}
+</script><noscript><p><img src="http://' . $rcmail->config->get('piwik_analytics_url') . '/piwik.php?idsite=' . $rcmail->config->get('piwik_analytics_id') . '" style="border:0" alt="" /></p></noscript>
+<!-- End Piwik Tag -->';
+
+ // add script to end of page
+ $rcmail->output->add_footer($script);
+
+ return $args;
+ }
+}
+
+?>
File Metadata
Details
Attached
Mime Type
text/x-diff
Expires
Mon, Aug 17, 10:03 PM (1 d, 15 h)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
1257922
Default Alt Text
(4 KB)
Attached To
Mode
R14 roundcubemail-plugins-kolab
Attached
Detach File
Event Timeline
Log In to Comment