Unofficial Swetrix Analytics integration for Vue.js.
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
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
},
})
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
},
})
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! 😀
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 [email protected].
If you are selfhosting the Swetrix-API, be sure to point the apiUrl
parameter to: https://yourapiinstance.com/log
You can support this project by donating me at: