Vue & Nuxt

Add the Lienks snippet to a Vue app or to Nuxt.

Before you start

Create your site and copy its site ID first (see Quick start).

Add the snippet

Vue (Vite) – add the snippet to the <head> of index.html:

<script defer src="https://app.lienks.com/a.js" data-site="YOUR_SITE_ID"></script>

Nuxt 3 – add it in nuxt.config.ts:

export default defineNuxtConfig({
  app: {
    head: {
      script: [
        { src: 'https://app.lienks.com/a.js', defer: true, 'data-site': 'YOUR_SITE_ID' }
      ]
    }
  }
});

Page views in your app

Vue Router in history mode uses the History API, so page changes are counted automatically. In hash mode (createWebHashHistory) the whole app shows up as a single page.

Track a custom event

Call window.lienks?.event('signup_clicked') wherever something should be counted. More in Custom events.

<script setup lang="ts">
function onSignup() {
  window.lienks?.event('signup_clicked');
}
</script>

<template>
  <button @click="onSignup">Sign up</button>
</template>

Vue templates can’t reach window directly, so the call lives in a function.

In TypeScript projects, declare window.lienks as described in Custom events.

Check that it works

Open your site. The first pageview shows up in the dashboard. If nothing arrives, see Troubleshooting.