Countly plugin for Vue 3.
npm install vue-countly   
> Countly plugin for Vue 3. For Vue 2, check out the v1 branch.
``text`
dist/
├── vue-countly.js (UMD, default)
├── vue-countly.min.js (UMD, compressed)
├── vue-countly.esm.js (ECMAScript Module)
├── vue-countly.esm.min.js (ECMAScript Module, compressed)
└── vue-countly.d.ts (TypeScript Declaration File)
Using npm:
`shell`
npm install vue@3 countly-sdk-web@21 vue-countly@2
Using pnpm:
`shell`
pnpm add vue@3 countly-sdk-web@21 vue-countly@2
Using Yarn:
`shell`
yarn add vue@3 countly-sdk-web@21 vue-countly@2
Using CDN:
`html`
`js
import { createApp, defineComponent } from 'vue';
import Countly from 'countly-sdk-web';
import VueCountly from 'vue-countly';
const app = createApp({
created() {
console.log(this.$Countly === Countly);
// > true
// Track sessions automatically (recommended)
this.$Countly.q.push(['track_sessions']);
// Track web page views automatically (recommended)
this.$Countly.q.push(['track_pageview']);
},
});
// Inject the $Countly property into all components within the application.``
app.use(VueCountly, Countly, {
app_key: 'YOUR_APP_KEY',
url: 'https://yourdomain.com/',
});
app.mount(document.body);
> See the available initialization config options of Countly.
Same as Vue 3.
Maintained under the Semantic Versioning guidelines.