All Projects → fvdm → nodejs-piwik

fvdm / nodejs-piwik

Licence: Unlicense license
Access a Matomo (Piwik) API from node.js

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to nodejs-piwik

ngx-matomo
Matomo (aka. Piwik) web analytics for Angular applications
Stars: ✭ 83 (+124.32%)
Mutual labels:  piwik, matomo
matomo-tracker
Stand alone library for using matamo tracking in frontend projects
Stars: ✭ 138 (+272.97%)
Mutual labels:  piwik, matomo
matomo-mediawiki-extension
www.mediawiki.org/wiki/Extension:Piwik_Integration
Stars: ✭ 18 (-51.35%)
Mutual labels:  piwik, matomo
hugo-component-matomo
Matomo user tracking and optout scripts for Hugo
Stars: ✭ 38 (+2.7%)
Mutual labels:  piwik, matomo
gatsby-plugin-matomo
🥂 Gatsby plugin to add Matomo (formerly Piwik) onto a site.
Stars: ✭ 56 (+51.35%)
Mutual labels:  piwik, matomo
Matomo
Liberating Web Analytics. Star us on Github? +1. Matomo is the leading open alternative to Google Analytics that gives you full control over your data. Matomo lets you easily collect data from websites & apps and visualise this data and extract insights. Privacy is built-in. We love Pull Requests!
Stars: ✭ 15,711 (+42362.16%)
Mutual labels:  piwik, matomo
matomo-for-wordpress
Get a fully functioning Matomo Analytics for your WordPress. Star us on Github? +1. Matomo is the leading open alternative to Google Analytics that gives you full control over your data. Privacy is built-in. 100% data ownership, no one else can see your data. We love Pull Requests!
Stars: ✭ 90 (+143.24%)
Mutual labels:  piwik, matomo
analytics
A Flarum extension that provides your forum piwik's and google's analytics features
Stars: ✭ 32 (-13.51%)
Mutual labels:  piwik
nodejs-ns-api
Unofficial NodeJS module for Nederlandse Spoorwegen API
Stars: ✭ 13 (-64.86%)
Mutual labels:  unlicense
FWK
💎 3D game framework in C, with Luajit bindings now.
Stars: ✭ 423 (+1043.24%)
Mutual labels:  unlicense
matomo-next
Matomo for Next.js applications
Stars: ✭ 87 (+135.14%)
Mutual labels:  matomo
piwik
Piwik-Besucherstatistik für REDAXO
Stars: ✭ 22 (-40.54%)
Mutual labels:  piwik
ip2location-piwik
Use IP2Location geolocation database to lookup for accurate visitor location in Matomo (Piwik) 3.x. It enables the user to find the country, region, city, coordinates, zip code, time zone, ISP, domain name, connection type, area code, weather, MCC, MNC, mobile brand name, elevation, usage type, address type and IAB category that any IP address o…
Stars: ✭ 26 (-29.73%)
Mutual labels:  matomo
python-whirlpool
Python wrapper extension for C Whirlpool digest reference implementation.
Stars: ✭ 18 (-51.35%)
Mutual labels:  unlicense
Rss Bridge
The RSS feed for websites missing it
Stars: ✭ 4,067 (+10891.89%)
Mutual labels:  unlicense
speedtest
Simple bandwidth test in browser javascript
Stars: ✭ 41 (+10.81%)
Mutual labels:  unlicense
nodejs-searchitunes
Lightweight node.js module to quickly search Apple's iTunes Store for music, movies, apps, etc.
Stars: ✭ 25 (-32.43%)
Mutual labels:  unlicense
nodejs-passdock
PassDock API methods for iOS Wallet (PassBook)
Stars: ✭ 13 (-64.86%)
Mutual labels:  unlicense
nodejs-geoip2ws
Maxmind GeoIP2 Web Services for Node.js
Stars: ✭ 47 (+27.03%)
Mutual labels:  unlicense
Matomo-PHP-API
PHP wrapper for the Matomo API.
Stars: ✭ 78 (+110.81%)
Mutual labels:  matomo

piwik (Matomo)

Track hits and access a Matomo API with Node.js

The package is named after the previous name of Matomo. I don't feel like changing the name, because people are using it in their apps.

npm Build Status Coverage Status

Example

const matomo = require ('piwik').setup ('https://example.tld/matomo/', 'abc123');

// track a pageview
matomo.track (
  {
    idsite:      1,
    url:         'https://mysite.tld/some/page',
    action_name: 'Page Title',
    _cvar:       { '1': ['group', 'customer'] },
  },
  console.log
);

Installation

npm install piwik

.setup

( baseURL, [token], [timeout] )

In order to use this module you need to start with setup().

argument type description
baseURL string The URL to your Matomo installation. Both HTTP and HTTPS are supported.
[token] string Your API access token. Either set token or include token_auth in the baseURL.
[timeout] integer Wait time in ms, default 5000 (5 seconds).
const matomo = require ('piwik').setup ('https://example.tld/matomo/', 'abc123');

.api

( vars, callback )

Call an API method.

argument type description
vars object see documentation
callback function (err, data)

Reporting API docs

// page urls for today
matomo.api (
  {
    method:   'Actions.getPageUrls',
    idSite:   1,
    period:   'day',
    date:     'today'
  },
  console.log
);

.track

( vars, callback )

Track a hit.

argument type description
vars object or array see documentation
[callback] function (err, data)

Tracking API docs

// track a pageview
matomo.track (
  {
    idsite:      1,
    url:         'https://mysite.tld/some/page',
    action_name: 'Page Title',
    _cvar:       { '1': ['group', 'customer'] },
  },
  console.log
);

// track many at once (log import)
matomo.track (
  [
    {
      idsite:      1,
      url:         'http://mysite.tld/some/page',
      action_name: 'Page Title',
    },
    {
      idsite:      1,
      url:         'http://mysite.tld/blog/123-hello',
      action_name: 'Hello World',
    },
  ],
  console.log
);

.loadSpammers

( callback )

Retrieve referrer spammers blocklist maintained by Piwik as an array.

Open source list

Disclaimer: the example below is intended only for educational purposes. ;)

const Kira = require ('Kira');
const revenge = new Kira();

piwik.loadSpammers ((err, list) => {
  if (err) { return console.log (err); }

  // Destroy them all
  list.forEach (target => {
    revenge.kill (`http://${target}`, 200, 10000);
  });
});

Callback and Errors

The callback function receives two parameters: err and data. When an error occurs err is an instance of Error. When all is good err is null and data is set.

message description additional
request failed Request cannot be made see err.error
http error HTTP error err.code and err.body
api error API error err.text
track failed Track method failed err.data
matomo.api (props, (err, data) => {
  if (err) {
    console.log (err);
    return;
  }

  console.log (data);
});

Unlicense

This is free and unencumbered software released into the public domain.

Anyone is free to copy, modify, publish, use, compile, sell, or distribute this software, either in source code form or as a compiled binary, for any purpose, commercial or non-commercial, and by any means.

In jurisdictions that recognize copyright laws, the author or authors of this software dedicate any and all copyright interest in the software to the public domain. We make this dedication for the benefit of the public at large and to the detriment of our heirs and successors. We intend this dedication to be an overt act of relinquishment in perpetuity of all present and future rights to this software under copyright law.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

For more information, please refer to https://unlicense.org

Author

Franklin | Buy me a coffee

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].