1.1.2 • Published 9 months ago

@skyanalytics/vue2 v1.1.2

Weekly downloads
-
License
MIT
Repository
github
Last release
9 months ago

SkyAnalytics Vue-2

SkyAnalytics Vue-2 is an adapter for SkyAnalytics that allows you to track your website's traffic and user behavior.

npm version

Installation

npm install @skyanalytics/vue2

Usage

import Vue from 'vue'
import SkyAnalytics from '@skyanalytics/vue2'

Vue.use(SkyAnalytics, {
    key: 'source_key',
    host: 'http://localhost:3000',
    enabled: true // default is true
})

Directives

<button v-sk-analytics="{ event: 'click', data: { key: 'value' } }">Click me</button>

Methods

this.$skyAnalytics.event('event', { key: 'value' })

Composable

import { useAnalytics } from '@skyanalytics/vue2'

useAnalytics.event('event', { key: 'value' })
useAnalytics.navigate('page', { key: 'value' })
useAnalytics.metadata({ key: 'value' })

Vue-Router

import Vue from 'vue'
import VueRouter from 'vue-router'
import SkyAnalytics, { useAnalytics } from '@skyanalytics/vue2'

Vue.use(VueRouter)
Vue.use(SkyAnalytics, {
    key: 'source_key',
    host: 'http://localhost:3000',
	enabled: true // default is true
})

const router = new VueRouter({
    routes: []
})

router.beforeEach((to, from, next) => {
    Vue.prototype.$skyAnalytics.navigation({ name: to.name })

    // or

    const analytics = useAnalytics()
    analytics.navigate(to.name)

    next()
})

!WARNING
Use with caution, the methods $skyAnalytics make sure that the instance is initialized and the plugin is enabled. Otherwise, it will throw an error.

1.1.2

9 months ago

1.1.1

10 months ago

1.1.0

10 months ago

1.0.6

10 months ago

1.0.5

11 months ago

1.0.4

11 months ago

1.0.3

11 months ago

1.0.2

1 year ago

1.0.1

1 year ago

1.0.0

1 year ago