piwik-wrap
A Promise-based wrapper for the Piwik JavaScript Tracking Client providing an enjoyable API
piwik-wrap wraps the Piwik JavaScript Tracking Client and provides an easy to use API for non- and Single Page Applications without polluting global namespace. All JavaScript Tracking Client methods are directly accessible through piwik-wrap.
usage
.init()
Before any other call Piwik must be initialized.
// client bootstrapping ; // ... some other imports and declarations Piwik;
.loadScript()
.loadScript()
returns a Promise
and initializes the Promise
-chain.
Piwik ;
.then()
// e.g. in a Controller var Piwik = ; // ... Piwik
.queue()
It is also possible to use .queue()
if you are unfamiliar with Promises.
// client bootstrapping ; // ... Piwik; // app.js // ... { Piwik ; } // ...
.p
// client bootstrapping ; // ... Piwik; // PageA.js // ... { const link = document; link
Piwik-API-Reference
Check: JavaScript Tracking Client.