1
Prepare Tracking Script
Copy your script from the bchic settings. It should include your
data-website-id.2
Insert into index.html
Search for the
index.html file in your project folder (in Vite projects, this is usually directly in the root directory or under /public).Insert the script into the <head> area:index.html
3
Deploy & Test
Once you publish your app (or start it locally), bchic starts tracking automatically. Click through your routes to ensure every page change is counted as a visit.
Custom Events (TypeScript-safe)
If you callwindow.bchic directly in the code, you often get TypeScript or ESLint errors (“Property ‘bchic’ does not exist on type ‘Window’”).
We therefore recommend the following best practice approach with a type definition and a composable.
1. Create Type Definition
Create a filesrc/bchic.d.ts so TypeScript knows the bchic object.
src/bchic.d.ts
2. Create Composable (Optional but recommended)
To make access even easier, create a composable undersrc/composables/useTracking.ts:
src/composables/useTracking.ts
3. Usage in Components
Now you can use tracking cleanly in every component:src/components/SignupButton.vue

