astro-umami-analytics

0.1.0 • Public • Published

astro-umami-analytics

An Astro component for easy integration of Umami analytics into your Astro projects.

Installation

To install astro-umami-analytics, run the following command in your project directory:

npm install astro-umami-analytics

Usage

To use the Umami component in your Astro project, follow these steps:

  1. Import the Umami component in your Astro layout or page:
---
import { Umami } from "astro-umami-analytics";
---
  1. Add the Umami component to your <head> section, providing your Umami website ID:
<head>
  <!-- Other head elements -->
  <Umami id="your-umami-website-id" />
</head>

Here's a complete example of how to use the Umami component in an Astro layout:

---
import { ViewTransitions } from "astro:transitions";
import { Umami } from "astro-umami-analytics";

interface Props {
  title: string;
  description: string;
}

const { title, description } = Astro.props;
---

<!doctype html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="description" content={description} />
    <meta name="viewport" content="width=device-width" />
    <link rel="icon" type="image/svg+xml" href="/favicon.svg" />
    <meta name="generator" content={Astro.generator} />
    <title>{title}</title>
    <ViewTransitions />
    <Umami id="your-umami-website-id" />
  </head>
  <body>
    <slot />
  </body>
</html>

Make sure to replace "your-umami-website-id" with your actual Umami website ID.

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

License

This project is licensed under the MIT License.

Author

Package Sidebar

Install

npm i astro-umami-analytics

Weekly Downloads

4

Version

0.1.0

License

MIT

Unpacked Size

3.65 kB

Total Files

6

Last publish

Collaborators

  • vrus