swetrix-vue v2.0.1
Swetrix Vue 3 integration
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:
1 year ago
1 year ago
1 year ago
1 year ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago