> For the complete documentation index, see [llms.txt](https://docs.humblytics.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.humblytics.com/how-to-get-started/vuejs.md).

# Vue.js

Add Humblytics to your Vue.js or Nuxt app in about 5 minutes.

{% hint style="info" %}
**You need:** access to your app's HTML shell and a production deploy. Local Vite or Webpack dev servers won't verify.
{% endhint %}

## 1. Copy your tracking code

In Humblytics, open **Site settings → Install** and click **Copy tracking code**.

## 2. Add it to your app

**Vue (Vite or Vue CLI):** paste the snippet just before `</head>` in `index.html` (Vite, project root) or `public/index.html` (Vue CLI). It loads once, and Humblytics tracks Vue Router navigation on its own.

**Nuxt 3:** add all three parts in `nuxt.config.ts`. Replace `YOUR_SCRIPT_ID` with the Script ID from your snippet:

```ts
const HMBL_ANTI_FLICKER = `
(function(){
  var w=window,l=location,d=document.documentElement,done=false;
  function k(p){p=String(p||'/').toLowerCase();while(p.length>1&&p.charAt(p.length-1)==='/')p=p.slice(0,-1);for(var h=5381,i=0;i<p.length;i++)h=((h*33)^p.charCodeAt(i))>>>0;return h.toString(36);}
  function r(){if(done)return;done=true;d.classList.remove('hmbl-pending');if(d.style.opacity==='0')d.style.opacity='';}
  w._hmblReveal=r;
  if(document.readyState!=='loading'||/[?&](hmblEditor|hmblSessionRecording|humblytics_heatmap_token)=|#preview-humblytics-/.test(l.search+l.hash))return;
  var st=new URLSearchParams(l.search).get('_st'),ref=document.referrer,same=!ref;
  try{same=same||new URL(ref).host===l.host;}catch(e){same=true;}
  if(st&&same&&st===k(l.pathname)){
    w._hmblSt=st;
    if(!(w.fbq||w.google_tag_manager||w.ttq)){var u=new URL(l.href);u.searchParams.delete('_st');history.replaceState(history.state,'',u.href);}
    return;
  }
  d.classList.add('hmbl-pending');
  function cap(){setTimeout(function(){if(!w.HumblyticsRedirectRunning)r();},2000);setTimeout(r,4000);}
  if(document.prerendering)document.addEventListener('prerenderingchange',cap,{once:true});else cap();
  w.addEventListener('pageshow',function(e){if(e.persisted)r();});
})();
`

export default defineNuxtConfig({
  app: {
    head: {
      style: [{ innerHTML: 'html.hmbl-pending body{opacity:0!important}' }],
      script: [
        { innerHTML: HMBL_ANTI_FLICKER },
        { src: 'https://app.humblytics.com/hmbl.min.js?id=YOUR_SCRIPT_ID', async: true },
      ],
    },
  },
})
```

<figure><img src="https://1281224403-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FqZMBn2D7F1lV2hgGTS2X%2Fuploads%2Fgit-blob-ac0509a4e7e3cbb9aeae93d43d2214b8077c191f%2Fcustom%20code%20script.gif?alt=media" alt=""><figcaption></figcaption></figure>

## 3. Deploy and verify

1. Deploy to production.
2. Back in Humblytics, click **Verify install** (during first-time setup, **Check my site now**).
3. Open your live site in a private window and click around. Your visit appears in **Observe → Analytics → Overview** under **Live Activity** within about a minute.

**Not verifying?** Test the production URL, not `localhost`, and load the script once in the shell page, not inside a component.

Still stuck? See [Verify & Troubleshoot Tracking](https://docs.humblytics.com/how-to-get-started/verify-and-troubleshoot-tracking.md).
