Eddayy / astro-matomo

Matomo integration for Astro

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Astro Matomo

npm npm GitHub package.json version GitHub Workflow Status

Installation

npm install astro-matomo

Or via Automatic Integration Setup:

npx astro add astro-matomo

Options

Options Type Description
enabled boolean Controls if the matomo script should be loaded
host string Url to your matomo installation
siteId number Matomo site id.
heartBeatTimer number If set the heart beat time will be enabled
disableCookies boolean If set cookies will be disabled
preconnect boolean Will create a preconnect link pointing to the matomo host
debug boolean Activate debug mode

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

Development

Make the package available in your local environment:

npm link

Go to the demo project and link the package:

npm link astro-matomo

Start the dev server:

npm run dev

About

Matomo integration for Astro

License:GNU General Public License v3.0


Languages

Language:TypeScript 100.0%