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

vue-client-actions-tracker-component

v1.0.2

Published

The easy-to-use vue component for web analytics tracking with user's consent.

Downloads

6

Readme

vue-client-actions-tracker-component

looks something like that :) tracker-component

This is the easy-to-use vue component for web analytics tracking with user's consent.

The component works with Vue 2.

The tracker won't work without user's consent. If user didn't choose option accepting tracking, than no client's actions will be tracked.

Set up

  npm i vue-client-actions-tracker-component

import Vue from 'vue'

// tracker component
import userTracker from 'vue-client-actions-tracker-component'
import '../node_modules/vue-client-actions-tracker-component/dist/vue-client-actions-tracker-component.css' // for styles

Vue.use(userTracker) // tracker uses vue-cookies plugin and by default cookies expiration date set to 90 days.

- If you want to change the expiration date: 
Vue.use(userTracker, {cookiesExpirationDate: '15d'})

How to use

Component generally has three options:

  1. Allow metrics (all tracking are allowed (e.g google analytics), cookies and localStorage also can be used)

  2. Only critical actions (only cookies and localStorage are available)

  3. Disallow any actions (no tracking is available, cookies (with the exception of one cookie that we are saving when user is choosing the option. it's needed so not to show the tracker component every time the user opens the page) and localStorage as well)

In your template use component like that:

<template>
    <userTracker/>
</template>

Properties

| Property | Required | Default | Type | Description | |-------------------|----------|--------------------------------------------------|--------|---------------------------------------------------------------------------------------------------------------------------------------------| | privacyPolicyLink | false | '' | String | If you want to have a special link to the privacy policy page you need to add this property with the url to the page. E.g. '/privacy-policy | | title | false | Choose the way to communicate with this website: | String | Title of your tracker | | buttonTitle | false | Ok | String | Title of the acceptance button | | allowTitle | false | Allow metrics | String | Title for the allow option | | criticalTitle | false | Only critical actions | String | Title for the critical only option | | disallowTitle | false | Disallow any actions | String | Title for the disallow actions option | | classCustom | false | '' | String | Custom classes for the component for custom styles |

Methods

The component has one method activateTracker so you can activate preferable web analytics:

    methods: {
      setTracker() {
        // i used matomo so my function looked something like that
        this.$matomo && this.$matomo.setConsentGiven();
        this.$matomo && this.$matomo.trackPageView();
      }
    }

The method fires only if user allowed metrics!

Example:

different title and custom class with activateTracker method

<template>
    <userTracker
      title="Some new title here"
      customClass="my-tracker"
      @activateTracker="setTracker"
    />
</template>