Skip to main content

πŸ“¦ Installing Trakg in Vue.js

You can use the Trakg script in your Vue.js app by inserting it in your root public/index.html file or dynamically through Vue lifecycle methods.

🧩 Option 1: Add in public/index.html

πŸ” Replace 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 the mounted() hook in a component:
Then include this component in your root layout or App.vue.

πŸ›‘ 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
Check your Trakg Dashboard for insights or contact support if you need help.