Skip to main content
Which method should I use?

Option A — CDN (No npm, No Installation)

This is the simplest method. Just paste a <script> tag into your HTML and you are done.

Step 1 — Paste just before </body>

Open index.html and paste this block just above the closing </body> tag:
Replace pk_live_YOUR_KEY_HERE with your actual API key from the Settings page.
Your full index.html example:

Track a button click


Track across multiple pages

If your site has multiple HTML pages (e.g., about.html, contact.html), paste the script tag in each file. Because you set autoTrackPageViews: true, the SDK automatically records the page URL — no extra code needed per page.
To avoid repeating the script tag on every page, create a shared analytics.js file and include it on every page with &lt;script src="analytics.js"&gt;&lt;/script&gt;.

Identify users after login


Option B — npm + Bundler (Vite, Webpack, Parcel)

Use this if you have a bundler but no framework like React or Vue.

Step 1 — Install

Step 2 — Initialize in your entry file

Open your bundler’s entry file (usually main.js or index.js) and add at the top:
main.js

Step 3 — Track events anywhere in your project

any-file.js

Verify it’s working

  1. Open your HTML file in a browser
  2. Press F12 and go to Console tab
  3. You should see:
  1. Go to your Analytiq Dashboard then Events — events appear within 10 seconds.