Are you an agency specialized in UX, digital marketing, or growth? Join our Partner Program

Learn / Guides / Website tracking guide

Back to guides

Website tracking guide

Whether you’re a casual internet user or you work on a website or product, website tracking and product analytics are a fundamental part of your daily life online.

As an individual, you’re likely interested in protecting your privacy. As a marketer, or a UX or product person, tracking is what helps you optimize a site, fix bugs, improve UX, and achieve business growth. When done right (and we’ll show you how), website tracking can be beneficial to both users and businesses.

In this guide, we explore website tracking from both sides and cover what it is, how it works, and how to use a privacy-focused approach to tracking website activity.

Last updated

16 Nov 2023

Reading time

9 min


💡 Hey, product teams, watch real Hotjar use cases for Product Managers here

Hotjar's powerful tools help product managers with their daily workflow to formulate hypotheses, run experiments, and make informed decisions.

Skip to the bits you need:

What is website tracking?

Website tracking (or web tracking) is a method of collecting, storing, and analyzing user activity across one or several web pages.

Most online businesses use some form of tracking, including:

  • Traffic tracking to measure web traffic, e.g. with Google Analytics

  • UX tracking to measure user behavior and improve user experience, e.g. with Hotjar

  • Preference tracking to store individual site settings, e.g. shopping carts and login details

  • Advertising tracking to measure the performance of ad campaigns, e.g. Facebook ads

What website tracking can measure

#An example of UX tracking showing user clicks and scrolling in a Hotjar recording
An example of UX tracking showing user clicks and scrolling in a Hotjar recording

Website or product tracking helps you:

  • See where visitors click, tap, and scroll on a page

  • Know if users are browsing on desktop or mobile

  • Find your best- and worst-performing pages

  • Optimize landing pages for conversion

  • Compare website traffic

  • Remarket an advertisement to previous website visitors

  • Measure the success of an email marketing campaign

The benefits of user tracking

When done right, website and user tracking can be beneficial to both individual users and businesses.

How tracking helps users

Website tracking technologies can help remember logins and preferences so you don’t need to start from scratch every time you visit a site. For example, if you add a bunch of items to your Amazon shopping cart but don’t check out, they’ll likely still be waiting for you a few days later.

Similarly, web tracking can help websites and products offer a more personalized experience, like tailoring content based on a visitor’s location or time zone:

#The Moz login page, personalized based on a user’s timezone
The Moz login page, personalized based on a user’s timezone

Individual users can also benefit from improved UX if tracking is used to spot and fix bugs and create more enjoyable and useful product and site experiences.

How tracking helps businesses

Improving UX doesn’t just benefit customers: happy users are good for business, leading to improved metrics like CTR (click-through rate), bounce rate, or conversion rate, and increased sign-ups and sales.

Website tracking also helps teams measure the performance of marketing campaigns, including SEO performance, as well as gain valuable insight to help with decision-making.

How websites track user activity

When you visit a website or app, data is collected from your device and web browser and used to tailor your experience or collect information on how and what you browse (this tracking usually happens automatically⁠—keep reading to learn how to stop it).

The two main types of website visitor tracking you need to know about are first-party and third-party: first-party tracking is data collected directly by the domain you’re visiting, while third-party tracking is when data is collected by a different party (we’ll show you how to avoid this type of data collection below).

Here’s an overview of the most common online tracking technologies and how they track behavior online.

IP tracking

#A map of real-time website visitor locations in GA4
A map of real-time website visitor locations in GA4

Every internet connection has a unique IP (Internet Protocol) address that’s associated with a country and approximate location.

Most website analytics tools, for example Google Analytics, use IP addresses to approximate user location, which can help teams understand where their audience is based, and segment data for insights.

For example, in Hotjar you can filter session recordings by user country to see how people in your target market interact with a page:

#User country shown in the Hotjar recordings dashboard
User country shown in the Hotjar recordings dashboard


#A hot jar of cookies (!)
A hot jar of cookies (!)

Most web analytics tools install browser cookies, which are small text files that store data and can identify a user when they visit different pages on a website—or, in some cases, track users across different websites.

There are several types of website cookie:

  • First-party cookies → generated by the site you’re on, only active when you’re on that site (for example, an ecommerce site that remembers what’s in your cart the next time you visit)

  • Third-party cookies → generated by a third-party site, can track users across multiple domains until the third-party cookie is deleted (for example, a Google Ad cookie used to serve targeted advertisements to the same user across different websites)

  • Session cookies → temporary cookies that only store data for a single session

  • Persistent cookies → permanent cookies that are stored until actively deleted

Pixel tracking

#Email open rate in Mailchimp, which is collected via Pixel tracking
Email open rate in Mailchimp, which is collected via Pixel tracking

Tracking pixels work in a similar way to cookies, except they are tiny transparent images (measuring 1x1 pixels) that load via HTML on web pages or emails. Whenever a tracking pixel is loaded, analytics tools can report on whether users have opened an email or visited a page.


Fingerprinting is the process of compiling a unique identifier from an individual’s browser and computer settings. Fingerprints can then be used to track browsing activity across multiple pages or websites.

Any identifier can be used as part of a web fingerprint, including:

  • Operating system (OS)

  • Screen resolution

  • Installed fonts

  • Browser add-ons or extensions

  • Browser version and settings

Device tracking

Device data—including OS, browser, and device type (i.e. desktop or mobile app)—is collected by many analytics tools, and can be used to troubleshoot website bugs and design issues on specific devices, browsers, or screen resolutions.

For example, Hotjar Recordings can be filtered by device, browser, and OS, which makes it easier to find bugs or barriers to conversion on specific setups:

<#Device-specific hotjar recording filters
Device-specific hotjar recording filters

Privacy-first web tracking

Whether you’re a business using tracking tools on your website or a user concerned about your privacy online, you’ll need to know what good and bad web tracking looks like.

For example, at Hotjar we take a privacy-first approach to tracking and design our tools to record user interactions, not sensitive data. We call it ‘privacy by design’. Here’s a quick rundown of some of our privacy features—use these as a benchmark for finding other privacy-first tools:

  • Hotjar is GDPR, CCPA, and LGPD compliant (see more on those below)

  • We follow the ‘Do Not Track’ flag on browsers

  • We do NOT collect users' IP addresses

  • Users can request to see and delete their data at any time

  • Data is never sold to or viewed by third parties

If you’re using any tracking tools on your product or website, you’ll need to comply with relevant web tracking laws, regulations, and guidelines.

Understand your users with Hotjar

Use Hotjar to safely track user behavior and understand how people experience and interact with your website or app.

Web tracking laws

Recent developments in data privacy legislation have led to increased requirements for companies to disclose how they track, store, and use visitor data.


The GDPR (General Data Protection Regulation) regulates how companies can handle data from EU individuals, regardless of where a company is based.


The CCPA (California Consumer Privacy Act) protects the personal data of California residents in the USA.


The LGPD (Lei Geral de Proteção de Dados) regulates how the personal data of Brazil residents is collected and processed.

How to stop a website tracking you

You can limit the number of ways that websites track you by taking a few small actions. Here are seven beginner-friendly ways to get started:

1. Turn on tracking protection in your browser

Turn on the Do Not Track (DNT) setting in your browser (here are instructions for Chrome and Firefox). Reputable website activity tracking tools, like Hotjar, will abide by DNT preferences.

In Firefox, you can also set Enhanced Privacy Protection to “Standard” or “Strict” to block social media and cross-site trackers and fingerprinting.

2. Block third-party cookies

#How to block third-party cookies in Google Chrome
How to block third-party cookies in Google Chrome

If you block all cookies, most websites won’t work properly (for example, you probably won’t be able to sign in). But blocking third-party cookies helps you limit some cross-site online tracking. Many browsers now block third-party cookies by default, but in Chrome you’ll need to go to Settings > Privacy and Security > Cookies and other site data and select “Block third-party cookies”.

3. Delete cookies

Set your browser to automatically delete cookies when you quit, or try to manually delete cookies regularly. Just remember that you’ll lose things like active logins and full shopping carts when cookies are removed.

4. Use a privacy browser extension or add-on

<#Blocked advertising trackers in Ghostery
Blocked advertising trackers in Ghostery

A privacy-focused browser extension, like Ghostery, can block website tracking scripts and help you understand which trackers are being used on a site, and what their purpose is.

5. Use a privacy-focused browser

A privacy-focused browser can provide additional website tracking blocking features. For example, Firefox blocks fingerprinting and cross-site cookies as standard, and Brave sends DNT requests by default.

6. Use a VPN

A VPN (Virtual Private Network), like ProtonVPN, will hide your IP address from websites. This does not stop websites from tracking you through other methods (e.g. cookies, pixels, or fingerprinting), but it will stop your ISP (Internet service provider) from collecting data on the websites you browse.

7. Block images in emails

#How to block external images in Gmail
How to block external images in Gmail

When you block images by default, email marketing software like Mailchimp can't use pixels to track when you open emails. In Gmail, go to Settings > General > Images and select “Ask before displaying external images”.

How to track website users (the right way)

Now you know what website tracking is and how to track with user website tracking privacy in mind, here’s a quick overview of how to get started.

1. Pick the right tool to track what you need

First, ask yourself: why do you want to track website users?

Yes, website tracking tools allow you to track almost anything on any digital product, but you need to think about your end goal so you don’t get stuck in a cycle of tracking, and reporting on metrics, just because you can.

For example, you might be trying to:

  • Increase traffic

  • Convert more customers

  • Increase sign-ups

  • Measure the value of ad spend

  • Increase usage of a product feature

Once you’ve defined your goal, you’ll be in a better place to find the right tool.

You can learn more about the best website tracking tools in the dedicated chapter of this guide, but here are a couple to get started with:

2. Install the tracking script


Most website tracking tools require you to add a small snippet of JavaScript code to every page you want to track.

If you’re using Hotjar, you can add your unique tracking code to Google Tag Manager, via WordPress plugin, or manually copy and paste it into the <head> section of your website.

3. Analyze the data

#A Hotjar user shares a heatmap with a team member to build a business case to increase buy-in
A Hotjar user shares a heatmap with a team member to build a business case to increase buy-in

As we mentioned above, there’s no point collecting data you’re never going to look at. Once you’ve got some numbers rolling in, it’s time to start analyzing the data in relation to your main tracking goal.

If you’re analyzing a heatmap to increase conversions, for example, you can start by asking yourself:

  • Are people seeing important content?

  • Are people clicking on key page elements (links, buttons, and CTAs)?

  • Are they confused by non-clickable elements?

  • Are they getting distracted?

  • Are they experiencing issues across devices?

You’ll get more out of website tracking if you analyze data from different sources. For example, combining Hotjar with Google Analytics will help you improve UX by learning both what happens on your site, and why.

Understand your users with Hotjar

Use Hotjar to safely track user behavior and understand how people experience and interact with your website or app.

Website tracking FAQs