🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
Sign inDemoInstall
Socket

nuxt-matomo

Package Overview
Dependencies
Maintainers
1
Versions
11
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

nuxt-matomo - npm Package Compare versions

Comparing version

to
1.0.0

CHANGELOG.md

39

package.json
{
"name": "nuxt-matomo",
"version": "0.5.1",
"version": "1.0.0",
"license": "MIT",

@@ -8,10 +8,17 @@ "description": "nuxt module for matomo analytics",

"homepage": "https://github.com/pimlie/nuxt-matomo",
"main": "index.js",
"main": "lib/module.js",
"files": [
"index.js",
"plugin.js"
"lib"
],
"scripts": {
"lint": "eslint --ext .js,.vue .",
"lint-fix": "eslint --ext .js,.vue --fix"
"build": "nuxt build test/fixture",
"dev": "nuxt test/fixture",
"download-matomo": "wget -O test/fixture/static/piwik.js https://raw.githubusercontent.com/matomo-org/matomo/master/js/piwik.js",
"lint": "yarn lint:lib && yarn lint:matomo",
"lint:lib": "eslint --ext .js,.vue .",
"lint:matomo": "if [ $(node -e \"console.log(require('fs').existsSync('./test/fixture/.nuxt/matomo'));\") = \"false\" ]; then yarn test:fixture; fi && eslint --no-ignore test/fixture/.nuxt/matomo/",
"release": "yarn lint && yarn test && standard-version",
"test": "yarn test:fixture && yarn test:e2e",
"test:fixture": "jest test/fixture",
"test:e2e": "jest test/e2e"
},

@@ -22,11 +29,25 @@ "publishConfig": {

"devDependencies": {
"@babel/core": "^7.2.2",
"@babel/plugin-syntax-dynamic-import": "^7.2.0",
"@babel/preset-env": "^7.2.3",
"@nuxtjs/eslint-config": "^0.0.1",
"babel-core": "7.0.0-bridge.0",
"babel-eslint": "^10.0.1",
"eslint": "^5.10.0",
"babel-jest": "^23.6.0",
"eslint": "^5.12.0",
"eslint-config-standard": "^12.0.0",
"eslint-plugin-html": "^5.0.0",
"eslint-plugin-import": "^2.14.0",
"eslint-plugin-node": "^8.0.0",
"eslint-plugin-jest": "^22.1.2",
"eslint-plugin-node": "^8.0.1",
"eslint-plugin-promise": "^4.0.1",
"eslint-plugin-standard": "^4.0.0"
"eslint-plugin-standard": "^4.0.0",
"eslint-plugin-vue": "^5.1.0",
"get-port": "^4.1.0",
"jest": "^23.6.0",
"jsdom": "^13.1.0",
"nuxt": "^2.3.4",
"puppeteer": "^1.11.0",
"standard-version": "^4.4.0"
}
}

@@ -1,10 +0,9 @@

# Matomo (previously Piwik) for Nuxt.js
# Matomo integration for Nuxt.js
<a href="https://travis-ci.org/pimlie/nuxt-matomo"><img src="https://api.travis-ci.org/pimlie/nuxt-matomo.svg" alt="Build Status"></a>
[![npm](https://img.shields.io/npm/dt/nuxt-matomo.svg?style=flat-square)](https://www.npmjs.com/package/nuxt-matomo)
[![npm (scoped with tag)](https://img.shields.io/npm/v/nuxt-matomo/latest.svg?style=flat-square)](https://www.npmjs.com/package/nuxt-matomo)
> Add Matomo to your nuxt.js application.
This plugins automatically sends first page and route change events to matomo
Add Matomo tracking to your nuxt.js application. This plugin automatically sends first page and route change events to matomo
**Note:** matomo is not enabled in `dev` mode.
You can set environment variable `NODE_ENV` to `production` for testing in dev mode.
> nuxt-matomo is not enabled in `dev` mode unless you set the debug option

@@ -20,31 +19,14 @@ ## Setup

## Options
## Usage
### `siteId`
- Required
### Setting configuration at runtime
### `matomoUrl`
You can add additional tracking info by adding a `route.meta.matomo` object in a middleware and by adding a matomo object or function to your page component.
Url to matomo installation
> The VueRouter afterEach guard which this plugin uses is called before your page component is created
### `trackerUrl`
The matomo javascript tracker is also injected as `$matomo` in your Nuxt instance to e.g. manually track a page view. See the [injected](./test/fixture/pages/injected.vue) and [manuallytracked](./test/fixture/pages/manuallytracked.vue) pages in the test fixture for an example
Url to piwik.php, default is `matomoUrl + 'piwik.php'`
### `scriptUrl`
Url to piwik.js, default is `matomoUrl + 'piwik.js'`
### `cookies`
If false, Matomo will be configured to not create a tracking cookie
Default: `(unset)`
### Setting configuration at runtime
You can push any additional tracking info to `_paq` at runtime by adding a matomo
object `route.meta.matomo` in the middleware or to the selected pages. An object
is used so we can override middleware variables for selected pages
Middleware example:
```javascript
##### Middleware example
```js
export default function ({ route, store }) {

@@ -60,4 +42,4 @@ route.meta.matomo = {

### Setting configuration at runtime for selected pages
```
##### Page component example
```js
<template>

@@ -69,6 +51,11 @@ <div>

</template>
<script>
export default {
// the matomo function is binded to the tracker
matomo (from, to, store) {
this.setCustomVariable(1, 'VisitorType', 'Special Member')
},
// or let the function return an object
matomo (from, to, store) {
return {

@@ -78,9 +65,70 @@ someVar: ['setCustomVariable', 1, 'VisitorType', 'Special Member']

},
// or simply set an object
matomo: {
someVar: ['setCustomVariable', 1, 'VisitorType', 'Special Member']
},
[...]
}
</script>
```
```
### Deprecation warning
## Consent
For the moment you can still use both `matomo` as `piwik` names for your middleware. The piwik name will be removed in a future version.
The plugin extends the matomo tracker with a `setConsent(<consentGiven>)` convenience method.
When `setConsent()` is called, the plugin will automatically call rememberConsentGiven when the module option consentExpires has been set. To forget consent you can pass false to this method.
See the [default layout](./test/fixture/layouts/default.vue) in the test fixture for how to use this method in combination with a Vuex store.
## Options
#### `siteId` (required)
The matomo siteId
#### `matomoUrl`
- Default: ` `
Url to matomo installation
#### `trackerUrl`
- Default: `matomoUrl + 'piwik.php'`
Url to piwik.php
#### `scriptUrl`
- Default: `matomoUrl + 'piwik.js'`
Url to piwik.js
#### `cookies`
- Default: `true`
If false, Matomo will not create a tracking cookie
#### `consentRequired`
- Default: `false`
If true, Matomo will not start tracking until the user has given consent
#### `consentExpires`
- Default: `0`
If greater than 0 and when the `tracker.setConsent` method is called then we call `rememberConsentGiven(<consentExpires>)` instead of `setConsentGiven`. See below for more information
#### `doNotTrack`
- Default: `false`
If true, dont track users who have set Mozilla's (proposed) Do Not Track setting
#### `debug`
- Default: `false`
If true, the plugin will log debug information to the console.
> The plugin also logs debug information when Nuxt's debug option is set
#### `verbose`
- Default: `false`
If true, the plugin will log every tracker function call to the console