Features Pricing GDPR cookie banner Google Consent Mode v2 WordPress plugin Cookiebot alternative For Agencies GDPR ePrivacy About Contact
RO | EN
Start Free →
Statistics

_hjViewportId (Hotjar) – What It Is and What It Does

_hjViewportId is a sessionStorage entry set by Hotjar to remember the viewport (browser window) size for the duration of a browsing session. It's part of Hotjar's behavioral analytics suite (heatmaps, session recordings) and is classified by CookieFix under the statistics category.

Name
_hjViewportId
Provider
Hotjar
Category
Statistics
Type
sessionStorage
Lifetime
Session
Consent
Yes, before it is set (GDPR / ePrivacy)

What is the _hjViewportId cookie?

_hjViewportId is an entry stored in the browser's sessionStorage by the Hotjar analytics script, a service owned by Contentsquare used for heatmaps, session recordings, and on-site surveys.

It appears as soon as the Hotjar tracking code loads and runs on a page, typically triggered by the visitor's first interaction with a site that has Hotjar installed.

What data it stores

The value holds information about the viewport dimensions (the visible browser window) that Hotjar uses to accurately reconstruct the page layout in session recordings and click/scroll heatmaps.

Since it's stored in sessionStorage rather than as a classic cookie, the data stays only in the current browser tab and is sent to Hotjar/Contentsquare servers along with the analytics events the script collects.

What it is used for

Its main purpose is technical: it lets Hotjar correctly display, in its dashboard, how the page looked to the visitor at the time, accounting for the screen or window size used.

For the site owner, this feeds into understanding user behavior — where visitors click, how far they scroll, where they struggle — as an analytics and UX-optimization tool rather than an advertising tracker.

Does it require consent?

Even though it's a sessionStorage entry rather than an HTTP cookie, EU ePrivacy rules (Directive 2002/58/EC, implemented in Romania via Law 506/2004) and GDPR treat any storage of information on a user's device used for analytics the same way. Classified under statistics, it requires the visitor's prior consent before being set.

Site owners must disclose Hotjar and _hjViewportId in their cookie policy, obtain explicit consent through the CMP banner before the Hotjar script loads, and allow visitors to withdraw consent afterwards.

How to block or delete _hjViewportId

A visitor can clear sessionStorage data by clearing browsing data in their browser or simply closing the tab/session, since this data doesn't persist across sessions. They can also block Hotjar's script from running using tracker-blocking browser extensions.

  • For site owners, the correct approach is blocking the Hotjar script before consent, rather than deleting the data afterward.
  • A CMP such as CookieFix automatically blocks the Hotjar script (and therefore the setting of _hjViewportId) until the visitor agrees to the statistics category, stopping it from loading until they interact with the consent banner.

Frequently asked questions

It's a sessionStorage entry, not a classic HTTP cookie, but legally it's treated the same way because it stores information on the user's device.

Only for the current browsing session; the data disappears when the visitor closes the tab or browser.

Yes, since it's classified under statistics, it requires the visitor's prior consent before being set.

Hotjar won't be able to correctly reconstruct the window size in heatmaps and session recordings for that visitor, but site browsing itself isn't affected.

Updated 7 September 2026 · Information comes from the provider’s public documentation and CookieFix scans; it is not legal advice.