---
title: "Hotjar · Nuxt Scripts"
description: "Use Hotjar in your Nuxt app."
canonical_url: "https://scripts.nuxt.com/scripts/v0/marketing/hotjar"
meta:
  "og:description": "Use Hotjar in your Nuxt app."
  "og:image": "https://scripts.nuxt.com/_og/d/c_Docs%2Ctitle_Hotjar%2Cdescription_Use%2BHotjar%2Bin%2Byour%2BNuxt%2Bapp.%2Cheadline_Marketing%2Cp_Ii9zY3JpcHRzL3YwL21hcmtldGluZy9ob3RqYXIi%2Cs_zowzOzdStGWO31xL.png"
  "og:image:height": "600"
  "og:image:type": image/png
  "og:image:width": "1200"
  "og:title": "Hotjar · Nuxt Scripts"
  "twitter:image": "https://scripts.nuxt.com/_og/d/c_Docs%2Ctitle_Hotjar%2Cdescription_Use%2BHotjar%2Bin%2Byour%2BNuxt%2Bapp.%2Cheadline_Marketing%2Cp_Ii9zY3JpcHRzL3YwL21hcmtldGluZy9ob3RqYXIi%2Cs_zowzOzdStGWO31xL.png"
---

> Index of every page on this site: [llms.txt](https://scripts.nuxt.com/llms.txt)

**Marketing**

# **Hotjar**

[Copy for LLMs](https://scripts.nuxt.com/scripts/v0/marketing/hotjar.md)

[**Hotjar**](https://www.hotjar.com/) is a screen recorder and heatmap tool that helps you understand how users interact with your website.

The simplest way to load Hotjar globally in your Nuxt App is to use Nuxt config. Alternatively you can directly use the **useScriptHotjar** composable.

## Loading Globally

If you don't plan to send custom events you can use the [**Environment overrides**](https://nuxt.com/docs/getting-started/configuration#environment-overrides) to disable the script in development.

```ts
export default defineNuxtConfig({
  scripts: {
    registry: {
      hotjar: {
        id: 123456, // your id
      }
    }
  }
})
```

## useScriptHotjar

The `**useScriptHotjar**` composable lets you have fine-grain control over when and how Hotjar is loaded on your site.

```ts
const { proxy } = useScriptHotjar({
  id: 123546,
})
// example
proxy.hj('identify', 123456, {
  name: 'John Doe',
  email: 'john@doe.com'
})
```

Please follow the [**Registry Scripts**](https://scripts.nuxt.com/docs/v0/guides/registry-scripts) guide to learn more about advanced usage.

### HotjarApi

```ts
export interface HotjarApi {
  hj: ((event: 'identify', userId: string, attributes?: Record<string, any>) => void)
  & ((event: 'stateChange', path: string) => void)
  & ((event: 'event', eventName: string) => void)
  & ((event: string, arg?: string) => void)
  & ((...params: any[]) => void) & {
    q: any[]
  }
}
```

### Config Schema

You must provide the options when setting up the script for the first time.

```ts
export const HotjarOptions = object({
  id: number(),
  sv: optional(number()),
})
```

## Example

Using Hotjar only in production while using `**hj**` to send a conversion event.

```vue
<script setup lang="ts">
const { proxy } = useScriptHotjar()

// noop in development, ssr
// just works in production, client
function sendConversion() {
  proxy.hj('event', 'conversion')
}
</script>

<template>
  <div>
    <button @click="sendConversion">
      Send Conversion
    </button>
  </div>
</template>
```

[Edit this page](https://github.com/nuxt/scripts/edit/0.x/docs/content/marketing/hotjar.md)

[Markdown For LLMs](https://scripts.nuxt.com/scripts/v0/marketing/hotjar.md)

[**Clarity** Use Clarity in your Nuxt app.](https://scripts.nuxt.com/scripts/v0/marketing/clarity) [**Lemon Squeezy** Use Lemon Squeezy in your Nuxt app.](https://scripts.nuxt.com/scripts/v0/payments/lemon-squeezy)

**On this page **

- [Loading Globally](#loading-globally)
- [useScriptHotjar](#usescripthotjar)
- [Example](#example)

```json
{"@context":"https://schema.org","@graph":[{"@id":"https://scripts.nuxt.com/#website","@type":"WebSite","description":"Nuxt Scripts lets you load third-party scripts with better performance, privacy, security and DX. It includes many popular third-parties out of the box.","name":"Nuxt Scripts","url":"https://scripts.nuxt.com/","publisher":{"@id":"https://scripts.nuxt.com/#identity"}},{"@id":"https://scripts.nuxt.com/scripts/v0/marketing/hotjar#webpage","@type":"WebPage","description":"Use Hotjar in your Nuxt app.","name":"Hotjar","url":"https://scripts.nuxt.com/scripts/v0/marketing/hotjar","breadcrumb":{"@id":"https://scripts.nuxt.com/scripts/v0/marketing/hotjar#breadcrumb"},"isPartOf":{"@id":"https://scripts.nuxt.com/#website"},"potentialAction":[{"@type":"ReadAction","target":["https://scripts.nuxt.com/scripts/v0/marketing/hotjar"]}],"primaryImageOfPage":{"@id":"https://scripts.nuxt.com/#logo"}},{"@id":"https://scripts.nuxt.com/#identity","@type":"Organization","name":"Nuxt Scripts","url":"https://scripts.nuxt.com","logo":{"@id":"https://scripts.nuxt.com/#logo"}},{"@id":"https://scripts.nuxt.com/scripts/v0/marketing/hotjar#breadcrumb","@type":"BreadcrumbList","itemListElement":[{"@type":"ListItem","name":"Nuxt Scripts","item":"https://scripts.nuxt.com/","position":1},{"@type":"ListItem","name":"Scripts","item":"https://scripts.nuxt.com/scripts","position":2},{"@type":"ListItem","name":"V0","item":"https://scripts.nuxt.com/scripts/v0","position":3},{"@type":"ListItem","name":"Marketing","item":"https://scripts.nuxt.com/scripts/v0/marketing","position":4},{"@type":"ListItem","name":"Hotjar","item":"https://scripts.nuxt.com/scripts/v0/marketing/hotjar","position":5}]},{"@id":"https://scripts.nuxt.com/#logo","@type":"ImageObject","caption":"Nuxt Scripts","contentUrl":"https://scripts.nuxt.com/logo.svg","inLanguage":"en","url":"https://scripts.nuxt.com/logo.svg"}]}
```

## Sitemap

See the full [sitemap](https://scripts.nuxt.com/sitemap.md) for all pages.
