3.0.1 • Published 7 months ago

@swup/matomo-plugin v3.0.1

Weekly downloads
-
License
MIT
Repository
github
Last release
7 months ago

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()]
});
3.0.1

7 months ago

3.0.0

10 months ago

2.0.0

1 year ago

1.0.1

1 year ago

1.0.0

4 years ago