AppSuite:Metrics-Adapters: Difference between revisions
No edit summary |
|||
Line 2: | Line 2: | ||
=== PIWIK === | === PIWIK === | ||
Adapter for the open-source analytics platform. | |||
==== source ==== | ==== source ==== | ||
Line 15: | Line 17: | ||
==== consider settings ==== | ==== consider settings ==== | ||
Please add at first a line into the code that checks for the user setting to prevent registering the adapter (more precisecly to extend the extension point) | |||
<code javascript> | <code javascript> | ||
Line 49: | Line 51: | ||
=== Console === | === Console === | ||
You can activate | A special debugging adapter that simply writes events to console. | ||
==== source ==== | |||
<code> | |||
io.ox/metrics/adapters/console.js | |||
</code> | |||
==== hint ==== | |||
You can activate this special adapter that writes events to console and tracks all events in browsers localstorage. To activate/deactivate simply paste this code into your console when you are logged in at appsuite: | |||
<code javascript> | <code javascript> | ||
// enable | // enable | ||
require('settings!io.ox/core').set('tracking/console/enabled', true).save(); | require('settings!io.ox/core').set('tracking/console/enabled', true).save(); | ||
// disable | // disable | ||
require('settings!io.ox/core').set('tracking/console/enabled', false).save(); | require('settings!io.ox/core').set('tracking/console/enabled', false).save(); | ||
Line 62: | Line 75: | ||
//directly accessing to the data | //directly accessing to the data | ||
metrics.hash | metrics.hash | ||
// please use the following only in chrome cause it is using console.table | // please use the following only in chrome cause it is using console.table | ||
metrics.show() | metrics.show() |
Revision as of 07:30, 22 September 2015
Adapters
PIWIK
Adapter for the open-source analytics platform.
source
io.ox/metrics/adapters/default.js
hint
Be aware to not use a name for your javascript files that matching common patterns of adblockers. For example in case we would name default.js PIWIK.js the adblocker would block the request and an error ocurred in the the browser.
consider settings
Please add at first a line into the code that checks for the user setting to prevent registering the adapter (more precisecly to extend the extension point)
if (!settings.get('tracking/[add-your-id-here]/enabled', false)) return;
extend
Now you will have to extend ‘io.ox/metrics/adapter’ to register your adapter. The metrics module will run through all registered adapters and calls existing functions.
ext.point('io.ox/metrics/adapter').extend({
id: 'piwik',
setup: function () {
// called once
},
trackVisit: function () {
// called for each tracked visit (usually called once)
},
trackEvent: function (baton) {
// called for each tracked event
},
trackPage: function (baton) {
// called for each opened application/module
},
trackVariable: function (baton) {
// usually called once
}
});
For further questions please take a look at the PIWIK adapter in the source code.
Console
A special debugging adapter that simply writes events to console.
source
io.ox/metrics/adapters/console.js
hint
You can activate this special adapter that writes events to console and tracks all events in browsers localstorage. To activate/deactivate simply paste this code into your console when you are logged in at appsuite:
// enable
require('settings!io.ox/core').set('tracking/console/enabled', true).save();
// disable
require('settings!io.ox/core').set('tracking/console/enabled', false).save();
You can see all tracked events by using the browers console again:
//directly accessing to the data
metrics.hash
// please use the following only in chrome cause it is using console.table
metrics.show()