Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/felix-berlin/astro-matomo
Matomo integration for Astro
https://github.com/felix-berlin/astro-matomo
analytics astrojs dsgvo gdrp gpr matomo privacy-friendly withastro
Last synced: about 24 hours ago
JSON representation
Matomo integration for Astro
- Host: GitHub
- URL: https://github.com/felix-berlin/astro-matomo
- Owner: felix-berlin
- License: gpl-3.0
- Created: 2023-02-25T15:13:42.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2024-06-07T13:17:31.000Z (4 months ago)
- Last Synced: 2024-09-18T08:22:52.009Z (7 days ago)
- Topics: analytics, astrojs, dsgvo, gdrp, gpr, matomo, privacy-friendly, withastro
- Language: TypeScript
- Homepage:
- Size: 29.7 MB
- Stars: 11
- Watchers: 1
- Forks: 2
- Open Issues: 4
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- Funding: .github/FUNDING.yml
- License: LICENSE
- Code of conduct: CODE_OF_CONDUCT.md
Awesome Lists containing this project
README
# Astro Matomo
![npm](https://img.shields.io/npm/dm/astro-matomo?logo=npm&style=flat-square)
![npm](https://img.shields.io/npm/v/astro-matomo?logo=npm&style=flat-square)
![GitHub package.json version](https://img.shields.io/github/package-json/v/felix-berlin/astro-matomo?label=github&logo=github&style=flat-square)
![GitHub Workflow Status](https://img.shields.io/github/actions/workflow/status/felix-berlin/astro-matomo/release.yml?label=release&logo=github&style=flat-square)## Installation
```bash
pnpm add astro-matomonpm install astro-matomo
yarn 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 timer will be enabled |
| `disableCookies?` | `boolean` | If set cookies will be disabled |
| `preconnect?` | `boolean` | Will create a preconnect link pointing to the matomo host |
| `setCookieDomain?` | `string` | Share the tracking cookie across multiple domains |
| `trackerUrl?` | `string` | Defaults to matomo.php |
| `srcUrl?` | `string` | Defaults to matomo.js |
| `debug?` | `boolean` | Activate debug mode |
| `partytown?` | `boolean` | Adds [Partytown](https://partytown.builder.io/) support. Matomo added as: `...` |
| `crossOrigin?` | `string` | Set `crossorigin` attribute |## Example usage
```js
// astro.config.mjsimport { 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:
```bash
pnpm link .npm link
```Go to the demo project and link the package:
```bash
pnpm link astro-matomonpm link astro-matomo
```Start the dev server:
```bash
pnpm run devnpm run dev
```