for the addon.
If you don't want to use the admin panel, you can configure the addon through
-the .htconfig file.
+the config/local.ini.php file.
-Open the .htconfig.php file and add "piwik" to the list of activated addons.
+Open the config/local.ini.php file and add "piwik" to the list of activated addons.
- $a->config['system']['addon'] = "piwik, ..."
+ [system]
+ addon = ...,piwik
-You have to add 4 more configuration variables for the addon:
+You can change 4 more configuration variables for the addon:
- $a->config['piwik']['baseurl'] = 'example.com/piwik/';
- $a->config['piwik']['sideid'] = '1';
- $a->config['piwik']['optout'] = true;
- $a->config['piwik']['async'] = false;
+ [piwik]
+ baseurl = example.com/piwik/
+ sideid = 1
+ optout = true
+ async = false
Configuration fields
---------------------
--- /dev/null
+<?php return <<<INI
+
+; Warning: Don't change this file! It only holds the default config values for this addon.
+; Instead overwrite these config values in config/local.ini.php in your Friendica directory
+
+[piwik]
+; baseurl (String)
+; This URL points to your Piwik installation.
+; Use the absolute path, remember trailing slashes but ignore the protocol (http/s) part of the URL.
+; Example: baseurl = example.com/piwik/
+baseurl =
+
+; siteid (Integer)
+; Change the *sideid* parameter to whatever ID you want to use for tracking your Friendica installation.
+sideid =
+
+; optout (Boolean)
+; This defines whether or not a short notice about the utilization of Piwik will be displayed on every
+; page of your Friendica site (at the bottom of the page with some spacing to the other content).
+; Part of the note is a link that allows the visitor to set an opt-out cookie which will prevent visits
+; from that user be tracked by Piwik.
+optout = true
+
+; async (Boolean)
+; This defines whether or not to use asynchronous tracking so pages load (or appear to load) faster.
+async = false
+
+INI;
+//Keep this line
\ No newline at end of file
*
* Configuration:
* Use the administration panel to configure the Piwik tracking addon, or
- * in case you don't use this add the following lines to your .htconfig.php
+ * in case you don't use this add the following lines to your config/local.ini.php
* file:
*
- * $a->config['piwik']['baseurl'] = 'www.example.com/piwik/';
- * $a->config['piwik']['siteid'] = '1';
- * $a->config['piwik']['optout'] = true; // set to false to disable
- * $a->config['piwik']['async'] = false; // set to true to enable
+ * [piwik]
+ * baseurl = example.com/piwik/
+ * sideid = 1
+ * optout = true ;set to false to disable
+ * async = false ;set to true to enable
*
* Change the siteid to the ID that the Piwik tracker for your Friendica
* installation has. Alter the baseurl to fit your needs, don't care
use Friendica\Core\L10n;
function piwik_install() {
+ Addon::registerHook('load_config', 'addon/piwik/piwik.php', 'piwik_load_config');
Addon::registerHook('page_end', 'addon/piwik/piwik.php', 'piwik_analytics');
logger("installed piwik addon");
}
function piwik_uninstall() {
+ Addon::unregisterHook('load_config', 'addon/piwik/piwik.php', 'piwik_load_config');
Addon::unregisterHook('page_end', 'addon/piwik/piwik.php', 'piwik_analytics');
logger("uninstalled piwik addon");
}
+function piwik_load_config(\Friendica\App $a)
+{
+ $a->loadConfigFile(__DIR__. '/config/piwik.ini.php');
+}
+
function piwik_analytics($a,&$b) {
/*
$a->page['htmlhead'] .= '<link rel="stylesheet" type="text/css" href="' . $a->get_baseurl() . '/addon/piwik/piwik.css' . '" media="all" />';
/*
- * Get the configuration variables from the .htconfig file.
+ * Get the configuration variables from the config/local.ini.php file.
*/
- $baseurl = Config::get('piwik','baseurl');
- $siteid = Config::get('piwik','siteid');
- $optout = Config::get('piwik','optout');
- $async = Config::get('piwik','async');
+ $baseurl = Config::get('piwik', 'baseurl');
+ $siteid = Config::get('piwik', 'siteid');
+ $optout = Config::get('piwik', 'optout');
+ $async = Config::get('piwik', 'async');
/*
* Add the Piwik tracking code for the site.