swetrix-vue
TypeScript icon, indicating that this package has built-in type declarations

2.0.1 • Public • Published

Swetrix Analytics

Swetrix Vue 3 integration

npm version Build Status Sourcegraph Netlify Status

Unofficial Swetrix Analytics integration for Vue.js.

Integration

Install

Run the following command to install in your project:

npm install swetrix-vue

Or with yarn:

yarn add swetrix-vue

Or with pnpm:

pnpm add swetrix-vue

Basic usage

You can now import, and use the Swetrix hook on your project:

// ./src/main.ts

import { createApp } from 'vue'
import Swetrix from 'swetrix-vue'

const app = createApp({})

app.use(Swetrix, {
  pid: 'SWETRIX_PROJECT_ID',
  // optional options
  initOptions: {
    // options
  },
  pageViewsOptions: {
    // options
  },
})

Debug-mode

When developing in localhost, Swetrix does not send events to avoid using your quota.
You can enable debug mode to send events when testing things locally. It will also log messages to console.

// ./src/main.ts

import { createApp } from 'vue'
import Swetrix from 'swetrix-vue'

const app = createApp({})

app.use(Swetrix, {
  pid: 'SWETRIX_PROJECT_ID',
  initOptions: {
    debug: true,
    // other options
  },
})

Advanced options

useSwetrix hook accepts 3 parameters: PID, initOptions, pageViewsOptions.
See the official documentation page for more details.
You can always create an issue in case of any questions! 😀

Contribution

Feel free to contribute to the source code by opening a pull requests.

For any questions, you can open an issue, refer to the official Swetrix FAQs page or reach them at contact@swetrix.com.

Self-hosted API

If you are selfhosting the Swetrix-API, be sure to point the apiUrl parameter to: https://yourapiinstance.com/log

Donate

You can support this project by donating me at:

Package Sidebar

Install

npm i swetrix-vue

Weekly Downloads

4

Version

2.0.1

License

MIT

Unpacked Size

9.02 kB

Total Files

6

Last publish

Collaborators

  • ansidev