Socket
Book a DemoInstallSign in
Socket

astro-matomo

Package Overview
Dependencies
Maintainers
1
Versions
16
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

astro-matomo

Matomo integration for Astro

1.9.0
latest
Source
npmnpm
Version published
Weekly downloads
526
24.35%
Maintainers
1
Weekly downloads
 
Created
Source

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
customSrcUrl?stringOptional. A full URL to the Matomo tracking script. If set, it overrides srcUrl.
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

Keywords

astro

FAQs

Package last updated on 09 Jun 2025

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.