🚨 Shai-Hulud Strikes Again:834 Packages Compromised.Technical Analysis →
Socket
Book a DemoInstallSign in
Socket

spyfu-vue-analytics

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

spyfu-vue-analytics

Easily log events to third party analytics providers

latest
Source
npmnpm
Version
0.2.0
Version published
Maintainers
1
Created
Source

spyfu-vue-analytics

build status coverage dev dependencies npm MIT License

Installation

This plugin enables easy logging of events to third party analytics providers.

# install with yarn
yarn add spyfu-vue-analytics

# or install with npm
npm install spyfu-vue-analytics

Basic usage

Once the package is pulled in, you must instruct Vue to use it.

import Analytics from 'spyfu-vue-analytics';
import Vue from 'vue';

Vue.use(Analytics, {
    events: {
        userSignup: {
            google: {
                // define any additional data to pass to the
                // google handler when this event happens.
            },
        },
    },
    handlers: {
        google(eventName, eventConfig, payload) {
            // log event to google analytics
        },
    },
    logPageView(route) {
        // log page view event
    },
});

Finally, when an event you care about happens, use the $logEvent function to call your handlers.

// component.vue
export default {
    methods: {
        onUserSignup() {
            this.$logEvent('userSignup', payload);
        },
    },
};

Keywords

analytics

FAQs

Package last updated on 21 Aug 2019

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts