Skip to content

thevrus/astro-umami-analytics

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

About

Easily integrate Umami analytics into your Astro projects with this simple, lightweight component.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published