π¦ Installing Trakg in Vue.js
You can use the Trakg script in your Vue.js app by inserting it in your rootpublic/index.html
file or dynamically through Vue lifecycle methods.
π§© Option 1: Add in public/index.html
YOUR_ID_GIVEN
with the actual Site ID from your Trakg dashboard.
βοΈ Option 2: Dynamically Load Script in Component
If you want to load the script dynamically (e.g. conditionally on a route or after auth), you can use themounted()
hook in a component:
π‘ Best Practices
- β
Use
defer
to prevent blocking HTML render. - β
Add script before the closing
</body>
tag. - β
Works with any form using
<form>
,<input>
,<textarea>
, or<select>
. - β No wrappers or custom components required β native HTML is supported.
π Youβre Ready!
Once installed, Trakg will:- Track form interactions
- Capture partial + completed submissions
- Show real-time analytics in your dashboard