npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@jaseeey/vue-umami-plugin

v1.2.0

Published

A plugin designed for Vue 3 which enables the use of Umami Analytics

Downloads

24

Readme

Vue Umami Plugin

The Vue Umami Plugin integrates Umami analytics by loading the library and injecting it into your application's DOM, allowing you to easily track page views and events.

Background and Scope

This library was created to reduce duplication and streamline the integration of Umami analytics into a number of my personal Vue projects. Though, I decided to share it with the community in the hope that others may find it useful for similar purposes, either as-is, or as a starting point.

Given its focused nature, the plugin has limitations and may lack functionality available through the official Umami library API.

Features

  • Automatic Page Tracking: Automatically track page views through your Vue router.
  • Event Tracking: Easily track custom events with minimal configuration.
  • Lazy Loading: The Umami script is loaded only when the document is ready, ensuring minimal impact on performance.
  • Queue System: Events are queued until the Umami script is loaded, ensuring no events are lost.

Requirements

  • Vue 3.x
  • Vue Router (optional, for automatic page tracking)

Installation

To install and use this plugin, you can include the library via npm:

npm install @jaseeey/vue-umami-plugin

Usage

To use the Vue Umami Plugin in your project, import it and use it within your Vue application setup:

import { createApp } from 'vue';
import { VueUmamiPlugin } from '@jaseeey/vue-umami-plugin';
import App from './App.vue';
import router from './router';

const app = createApp(App);

app.use(VueUmamiPlugin, {
    websiteID: 'YOUR_UMAMI_WEBSITE_ID',
    scriptSrc: 'https://us.umami.is/script.js', // Optional
    router
});

app.use(router).mount('#app');

Tracking Events

To track custom events:

import { trackUmamiEvent } from 'vue-umami-plugin';

trackUmamiEvent('button-click', { buttonName: 'subscribe' });

API Reference

VueUmamiPlugin(options)

Initialises the Umami tracking plugin with specified options.

  • Parameters
    • options (Object):
      • websiteID (String): The Umami website ID required for tracking.
      • scriptSrc (String, optional): Custom URL for the Umami script source, default: https://us.umami.is/script.js
      • router (Router, optional): The Vue Router instance for automatic page tracking.

trackUmamiEvent(event, eventParams)

Sends a custom tracking event to Umami.

  • Parameters
    • event (String): The name of the event to track.
    • eventParams (Object, optional): Additional parameters for the event; typically includes details like page URL or user actions.

Contributions

You can contribute to this project by submitting a pull request or reporting issues in the issues section of this repository.

License

This project is licensed under the MIT License, see the LICENSE file for details.