parent
d9808fecdf
commit
e20f30888f
|
@ -25,18 +25,20 @@ your ~friendica server and then enter the needed details on the config page
|
||||||
for the addon.
|
for the addon.
|
||||||
|
|
||||||
If you don't want to use the admin panel, you can configure the addon through
|
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/';
|
[piwik]
|
||||||
$a->config['piwik']['sideid'] = '1';
|
baseurl = example.com/piwik/
|
||||||
$a->config['piwik']['optout'] = true;
|
sideid = 1
|
||||||
$a->config['piwik']['async'] = false;
|
optout = true
|
||||||
|
async = false
|
||||||
|
|
||||||
Configuration fields
|
Configuration fields
|
||||||
---------------------
|
---------------------
|
||||||
|
|
|
@ -0,0 +1,29 @@
|
||||||
|
<?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
|
|
@ -16,13 +16,14 @@
|
||||||
*
|
*
|
||||||
* Configuration:
|
* Configuration:
|
||||||
* Use the administration panel to configure the Piwik tracking addon, or
|
* 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:
|
* file:
|
||||||
*
|
*
|
||||||
* $a->config['piwik']['baseurl'] = 'www.example.com/piwik/';
|
* [piwik]
|
||||||
* $a->config['piwik']['siteid'] = '1';
|
* baseurl = example.com/piwik/
|
||||||
* $a->config['piwik']['optout'] = true; // set to false to disable
|
* sideid = 1
|
||||||
* $a->config['piwik']['async'] = false; // set to true to enable
|
* 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
|
* 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
|
* installation has. Alter the baseurl to fit your needs, don't care
|
||||||
|
@ -34,17 +35,24 @@ use Friendica\Core\Config;
|
||||||
use Friendica\Core\L10n;
|
use Friendica\Core\L10n;
|
||||||
|
|
||||||
function piwik_install() {
|
function piwik_install() {
|
||||||
|
Addon::registerHook('load_config', 'addon/piwik/piwik.php', 'piwik_load_config');
|
||||||
Addon::registerHook('page_end', 'addon/piwik/piwik.php', 'piwik_analytics');
|
Addon::registerHook('page_end', 'addon/piwik/piwik.php', 'piwik_analytics');
|
||||||
|
|
||||||
logger("installed piwik addon");
|
logger("installed piwik addon");
|
||||||
}
|
}
|
||||||
|
|
||||||
function piwik_uninstall() {
|
function piwik_uninstall() {
|
||||||
|
Addon::unregisterHook('load_config', 'addon/piwik/piwik.php', 'piwik_load_config');
|
||||||
Addon::unregisterHook('page_end', 'addon/piwik/piwik.php', 'piwik_analytics');
|
Addon::unregisterHook('page_end', 'addon/piwik/piwik.php', 'piwik_analytics');
|
||||||
|
|
||||||
logger("uninstalled piwik addon");
|
logger("uninstalled piwik addon");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function piwik_load_config(\Friendica\App $a)
|
||||||
|
{
|
||||||
|
$a->loadConfigFile(__DIR__. '/config/piwik.ini.php');
|
||||||
|
}
|
||||||
|
|
||||||
function piwik_analytics($a,&$b) {
|
function piwik_analytics($a,&$b) {
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -55,12 +63,12 @@ function piwik_analytics($a,&$b) {
|
||||||
$a->page['htmlhead'] .= '<link rel="stylesheet" type="text/css" href="' . $a->get_baseurl() . '/addon/piwik/piwik.css' . '" media="all" />';
|
$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');
|
$baseurl = Config::get('piwik', 'baseurl');
|
||||||
$siteid = Config::get('piwik','siteid');
|
$siteid = Config::get('piwik', 'siteid');
|
||||||
$optout = Config::get('piwik','optout');
|
$optout = Config::get('piwik', 'optout');
|
||||||
$async = Config::get('piwik','async');
|
$async = Config::get('piwik', 'async');
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Add the Piwik tracking code for the site.
|
* Add the Piwik tracking code for the site.
|
||||||
|
|
Loading…
Reference in New Issue