1.8.0 • Published 5 months ago

astro-matomo v1.8.0

Weekly downloads
-
License
GPL-3.0
Repository
github
Last release
5 months ago

Astro Matomo

npm npm GitHub package.json version GitHub Workflow Status

Installation

pnpm add astro-matomo

npm install astro-matomo

yarn add astro-matomo

Options

OptionsTypeDescription
enabledbooleanControls if the matomo script should be loaded
hoststringUrl to your matomo installation
siteIdnumberMatomo site id.
heartBeatTimer?numberIf set the heart beat timer will be enabled
disableCookies?booleanIf set cookies will be disabled
preconnect?booleanWill create a preconnect link pointing to the matomo host
setCookieDomain?stringShare the tracking cookie across multiple domains
trackerUrl?stringDefaults to matomo.php
srcUrl?stringDefaults to matomo.js
debug?booleanActivate debug mode
partytown?booleanAdds Partytown support. Matomo added as: <script type="text/partytown">...</script>
crossOrigin?stringSet crossorigin attribute
viewTransition?boolean or { contentElement: string }If true Matomo works in "SPA Mode" and will track every page visit after astro:page-load. When you pass a selector to contentElement Matomo is able to track new media files, forms and content

Example usage

// astro.config.mjs

import { defineConfig } from 'astro/config';
import matomo from 'astro-matomo';

// https://astro.build/config
export default defineConfig({
  site: "https://example.lol",
  integrations: [
    matomo({
      enabled: import.meta.env.PROD, // Only load in production
      host: "https://analytics.example.lol/",
      setCookieDomain: "*.example.lol",
      trackerUrl: "js/", // defaults to matomo.php
      srcUrl: "js/", // defaults to matomo.js
      siteId: 666,
      heartBeatTimer: 5,
      disableCookies: true,
      debug: false,
      viewTransition: {
        contentElement: "main"
      }
    }),
  ]
});

Development

Go to demo directory:

cd demo

Go to the demo project and install the dev package:

pnpm install

npm install

Start the dev server:

pnpm run dev

npm run dev
1.8.0

5 months ago

1.7.0

7 months ago

1.6.0

1 year ago

1.5.0

1 year ago

1.4.2

1 year ago

1.4.1

2 years ago

1.4.0

2 years ago

1.3.1

2 years ago

1.3.0

2 years ago

1.2.1

2 years ago

1.2.0

2 years ago

1.1.0

2 years ago

1.0.0

2 years ago