@swup/matomo-plugin
TypeScript icon, indicating that this package has built-in type declarations

3.0.1 • Public • Published

Swup Matomo Plugin

A swup plugin for integrating Matomo analytics.

  • Trigger pageview events after each page change
  • This event is not triggered on intial load, so the first page view must be triggered elsewhere
  • However, the page view event is by default triggered in the Javascripts tracking snippet used for embedding Matomo

Simplified code run by this plugin on the page:view hook:

_paq.push(['setDocumentTitle', document.title]);
_paq.push(['setCustomUrl', window.location.pathname + window.location.search]);
_paq.push(['trackPageView']);

Installation

Install the plugin from npm and import it into your bundle.

npm install @swup/matomo-plugin
import SwupMatomoPlugin from '@swup/matomo-plugin';

Or include the minified production file from a CDN:

<script src="https://unpkg.com/@swup/matomo-plugin@2"></script>

Usage

To run this plugin, include an instance in the swup options.

const swup = new Swup({
  plugins: [new SwupMatomoPlugin()]
});

Readme

Keywords

none

Package Sidebar

Install

npm i @swup/matomo-plugin

Weekly Downloads

16

Version

3.0.1

License

MIT

Unpacked Size

19.3 kB

Total Files

14

Last publish

Collaborators

  • hirasso
  • daun
  • gmrchk