matomo-tracker

WebJar for matomo-tracker

Лицензия

Лицензия

MIT
Группа

Группа

org.webjars.npm
Идентификатор

Идентификатор

matomo-tracker
Последняя версия

Последняя версия

2.2.0
Дата

Дата

Тип

Тип

jar
Описание

Описание

matomo-tracker
WebJar for matomo-tracker
Ссылка на сайт

Ссылка на сайт

http://webjars.org
Система контроля версий

Система контроля версий

https://github.com/matomo-org/matomo-nodejs-tracker

Скачать matomo-tracker

Как подключить последнюю версию

<!-- https://jarcasting.com/artifacts/org.webjars.npm/matomo-tracker/ -->
<dependency>
    <groupId>org.webjars.npm</groupId>
    <artifactId>matomo-tracker</artifactId>
    <version>2.2.0</version>
</dependency>
// https://jarcasting.com/artifacts/org.webjars.npm/matomo-tracker/
implementation 'org.webjars.npm:matomo-tracker:2.2.0'
// https://jarcasting.com/artifacts/org.webjars.npm/matomo-tracker/
implementation ("org.webjars.npm:matomo-tracker:2.2.0")
'org.webjars.npm:matomo-tracker:jar:2.2.0'
<dependency org="org.webjars.npm" name="matomo-tracker" rev="2.2.0">
  <artifact name="matomo-tracker" type="jar" />
</dependency>
@Grapes(
@Grab(group='org.webjars.npm', module='matomo-tracker', version='2.2.0')
)
libraryDependencies += "org.webjars.npm" % "matomo-tracker" % "2.2.0"
[org.webjars.npm/matomo-tracker "2.2.0"]

Зависимости

Библиотека не имеет зависимостей. Это самодостаточное приложение, которое не зависит ни от каких других библиотек.

Модули Проекта

Данный проект не имеет модулей.

Matomo Tracker NPM version Build Status

A wrapper for the Matomo Tracking HTTP API

Usage

First, install matomo-tracker as a dependency:

npm install --save matomo-tracker

Then, use it in your project:

var MatomoTracker = require('matomo-tracker');

// Initialize with your site ID and Matomo URL
var matomo = new MatomoTracker(1, 'http://mywebsite.com/matomo.php');

// Optional: Respond to tracking errors
matomo.on('error', function(err) {
  console.log('error tracking request: ', err);
});

// Track a request URL:
// Either as a simple string …
matomo.track('http://example.com/track/this/url');

// … or provide further options:
matomo.track({
  url: 'http://example.com/track/this/url',
  action_name: 'This will be shown in your dashboard',
  ua: 'Node.js v0.10.24',
  cvar: JSON.stringify({
    '1': ['custom variable name', 'custom variable value']
  })
});

// … or trackBulk:
var events = [{
  '_id': 'AA814767-7B1F-5C81-8F1D-8E47AD7D2982',
  'cdt': '2018-03-22T02:32:22.867Z',
  'e_c': 'Buy',
  'e_a': 'rightButton',
  'e_v': '2'
},{
  '_id': 'AA814767-7B1F-5C81-8F1D-8E47AD7D2982',
  'cdt': '2018-03-22T02:33:52.962Z',
  'e_c': 'Buy',
  'e_a': 'leftButton',
  'e_v': '4'
}];
matomo.trackBulk(events, (resData) => {
  // done.
})

That's it. For a complete list of options, see Matomo's Tracking HTTP API Reference.

Advanced usage

If you renamed the tracking file piwik.php or matomo.php of your matomo instance, the following error will be thrown:

new MatomoTracker(1, 'http://matomo.my-site.com/my-file.php'))
// ERROR: A tracker URL must end with "matomo.php" or "piwik.php"

To skip this check, simply pass true as third argument to the constructor:

new MatomoTracker(1, 'http://matomo.my-site.com/my-file.php', true))
// OK

License

MIT License

org.webjars.npm

Matomo Analytics

Open Source Analytics Piwik is now Matomo

Версии библиотеки

Версия
2.2.0