hotjar
БесплатноБез исполняемых скриптовНе проверенHotjar adds heatmaps, session recordings, surveys and feedback widgets to a website so you can see how visitors actually use it. Covers installing the…
от TerminalSkills★ 221 звезда на GitHubОб этом скилле
Hotjar
Overview
Hotjar records sessions, builds heatmaps and runs surveys on a site you own. Everything is configured in the Hotjar dashboard (heatmaps, recordings, survey targeting); your code only loads the tracking script and, optionally, sends user attributes and events through the hj function. Tracking code version hjsv: 6 is current in the official @hotjar/browser package (1.0.9). Docs: https://help.hotjar.com (the help center blocks automated fetching, so confirm dashboard wording in a browser).
Instructions
1. Install the script
Find the site ID in the dashboard (Sites and organizations). Either paste the snippet into <head> or use the npm package.
<head>
<script>
(function(h,o,t,j,a,r){
h.hj=h.hj||function(){(h.hj.q=h.hj.q||[]).push(arguments)};
h._hjSettings={hjid:3841205,hjsv:6};
a=o.getElementsByTagName('head')[0];
r=o.createElement('script');r.async=1;
r.src=t+h._hjSettings.hjid+j+h._hjSettings.hjsv;
a.appendChild(r);
})(window,document,'https://static.hotjar.com/c/hotjar-','.js?sv=');
</script>
</head>
The package wraps the same snippet and is typed:
npm install @hotjar/browser
// src/analytics/hotjar.ts
import Hotjar from '@hotjar/browser'
export function initHotjar() {
const siteId = Number(process.env.NEXT_PUBLIC_HOTJAR_SITE_ID)
if (!siteId) return
Hotjar.init(siteId, 6, { debug: false })
}
Hotjar.init(siteId, 6, opts) accepts debug and nonce. The package also exposes identify(userId | null, attributes), event(name), stateChange(path) and isReady().
2. Next.js App Router
Initialize once on the client, in production only, so development traffic does not pollute the data.
// components/hotjar-init.tsx
'use client'
import { useEffect } from 'react'
import Hotjar from '@hotjar/browser'
export function HotjarInit() {
useEffect(() => {
if (process.env.NODE_ENV !== 'production') return
Hotjar.init(Number(process.env.NEXT_PUBLIC_HOTJAR_SITE_ID), 6)
}, [])
return null
}
Render <HotjarInit /> inside <body> of app/layout.tsx.
3. Identify users and send events
// lib/hotjar.ts
declare global {
interface Window { hj: (...args: any[]) => void }
}
// Attributes become filters on recordings and heatmaps; values are string, number, date or boolean.
export const identify = (userId: string, attrs: Record<string, string | number | boolean>) =>
window.hj('identify', userId, attrs)
// Events can start a recording, trigger a survey or filter sessions.
export const track = (eventName: string) => window.hj('event', eventName)
// Tags are passed as an array.
export const tagRecording = (...tags: string[]) => window.hj('tagRecording', tags)
Use stable, non-sensitive IDs from your own database. Do not send e-mail addresses or names as attributes unless your privacy policy and Hotjar data agreement cover it.
4. Surveys
Surveys are shown by the targeting rules you set in the dashboard. To show one at a precise moment, set its trigger to a Hotjar event in the survey builder and fire that event from code:
track('checkout_completed') // survey "Post-purchase NPS" listens to this event name
track('cancel_clicked') // exit survey for cancellations
Event names must match the dashboard exactly. Do not rely on any other client call for surveys: only the event route is documented for current surveys.
5. Single-page apps
Hotjar listens for History API navigation on most SPAs. If a router changes content without updating the URL through the History API, tell Hotjar:
// hooks/use-hotjar-route.ts
'use client'
import { usePathname } from 'next/navigation'
import { useEffect } from 'react'
export function useHotjarRoute() {
const pathname = usePathname()
useEffect(() => {
if (typeof window.hj === 'function') window.hj('stateChange', pathname)
}, [pathname])
}
6. Content Security Policy
Pass a nonce to the loader and allow Hotjar hosts. The header below is a minimal sketch: recordings also need Hotjar's connect-src, img-src and font-src hosts, so copy the complete list from Hotjar's CSP help article and test in the browser console for blocked requests.
Hotjar.init(siteId, 6, { nonce: 'rAnD0m8f3a' })
Content-Security-Policy: script-src *.hotjar.com 'nonce-rAnD0m8f3a'; frame-src *.hotjar.com
7. Privacy
Mark sensitive parts in your markup. data-hj-suppress hides the text of an element in recordings and heatmaps; data-hj-allow re-allows an element that a broader rule would hide.
Add the bare attribute, for example data-hj-suppress on the element showing a card balance, and data-hj-allow on a public plan name inside a suppressed section.
Hotjar suppresses keystrokes and password fields by default, and offers site-wide masking choices in the dashboard under the site's privacy settings. Check
Установить hotjar в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
Вложенные файлы
FAQ
Что делает скилл hotjar?
Hotjar adds heatmaps, session recordings, surveys and feedback widgets to a website so you can see how visitors actually use it. Covers installing the tracking snippet or the @hotjar/browser package, identifying users, sending events, SPA page changes, a CSP nonce, element suppression for privacy and linking sessions to Google Analytics. Use when asked to "add Hotjar", "record user sessions", "set up heatmaps", "trigger a Hotjar survey" or "hide sensitive fields from recordings".
Как установить скилл hotjar?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл hotjar запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
skill-creator
Create new skills, modify and improve existing skills, and measure skill performance. Use when users want to create a skill from scratch, edit, or optimize an…
от Anthropicdiscernment-nudge
After you give a substantive answer or draft that the user may act on — advice or recommendations, drafted artifacts such as goals, plans, pitches, proposals…
от Anthropicdata-consolidate
Joins the plant's scheduled exports and connector data into one working dataset — ERP items (NetSuite or Infor M3), sales orders, production work orders…
от Anthropicinspection-to-capa
Runs the quality chain end to end: writes the nonconformance against the requirement it violates, searches history at the moment of writing to say whether…
от Anthropic