@usermaven/vue
TypeScript icon, indicating that this package has built-in type declarations

1.5.5 • Public • Published

@usermaven/vue

Vue.js SDK for Usermaven Analytics

Installation

npm install @usermaven/vue
# or
yarn add @usermaven/vue

Usage

Setup the Plugin

import { createApp } from 'vue'
import { UsermavenPlugin } from '@usermaven/vue'
import App from './App.vue'

const app = createApp(App)

app.use(UsermavenPlugin, {
    key: 'your-api-key',
    trackingHost: 'https://events.usermaven.com',
    autocapture: true,
    // Additional options

})

app.mount('#app')

Using the Composables

useUsermaven

<script setup>
import { useUsermaven } from '@usermaven/vue'

const usermaven = useUsermaven()

// Track an event
usermaven.track('button_click', {
  buttonId: 'submit-button'
})

// Identify a user
usermaven.identify({
  id: 'user_123_456',
  email: 'user@example.com',
  name: 'John Doe',
  // ... more fields
})
</script>

usePageView

<script setup>
import { usePageView } from '@usermaven/vue'

// Automatically tracks page views when route changes
const { track } = usePageView()

// Manually track a page view if needed
// track('pageview')
</script>

License

MIT

Readme

Keywords

none

Package Sidebar

Install

npm i @usermaven/vue

Weekly Downloads

18

Version

1.5.5

License

none

Unpacked Size

26.4 kB

Total Files

6

Last publish

Collaborators

  • usermaven