Learn / Guides / Website tracking guide

Back to guides

How to track user activity on your website

User activity tracking is the process of monitoring, collecting, and analyzing visitor browsing behavior on a website or app.

The easiest and most popular way to start tracking users is to set up Google Analytics (we'll show you how below). But Google Analytics (GA) can be equal parts overwhelming and limited: it’s packed with options but will only show you what happens on your site, not why.

That’s why the bulk of this guide will focus on showing you how to go beyond Google Analytics and track user activity with behavior analytics tools like heatmaps and session recordings to understand what’s happening, fix issues, and spot those all-important optimization opportunities.

PX insights and behavior analytics

Ways to Track User Activity on a Website

Businesses and web domains use a number of tracking software tools to view how users behave on their website. Some of the most common ways to track user activity include:

  • Tools like Google Analytics and Search Console

  • Click tracking (recording which elements on a page users click)

  • Scroll tracking (recording where users scroll on a page)

  • Viewing session recordings of users as they use their site

We’ll go over these tracking methods in detail below and show you how to use them effectively.

How to track users with Google Analytics

<#GA4 dashboard
GA4 dashboard

Google Analytics (GA) is the most popular traditional web analytics tool, used by 74% of analytics professionals. If you’ve already got GA set up, you can skip to the next section. If not, here’s a quick overview of the set-up process:

1. Create and configure your Google Analytics account

<

There are currently two versions of Google Analytics: the old one (Universal Analytics) and the new one (GA4, launched in October 2020).

Here’s how to set up GA4.

Here’s how to set up Universal Analytics.

And here’s how to switch from Universal Analytics to GA4.

2. Add GA tracking code to your pages

<

Paste the global site tag into the <head> section of every page, or add it with Google Tag Manager.

3. View reports

<#Realtime traffic overview in GA4
Realtime traffic overview in GA4

Google Analytics will generate reports as soon as you get some traffic to your site.

Start with the Realtime report (Reporting > Realtime) to view live traffic data and verify that GA is set up correctly.

The problem(s) with GA

GA lets you track many useful quantitative metrics, like ecommerce transactionsevents, and conversions, but there are two main issues:

1) There’s so much data it can be overwhelming: getting started with GA is fairly straightforward, but becoming an expert can be a full-time job (literally).

<#Google Analytics: it’s a full-time job
Google Analytics: it’s a full-time job

There are so many features and options, and GA4 produces radically different reports to the ones we’ve been used to for the past 5-10 years. Our survey of analytics professionals revealed that 1 in 5 people found tools like Google Analytics to be overwhelming (and that was before GA4).

2) It doesn’t tell you why users behave as they do: for example, you might learn that a landing page has low engagement from GA data, but you can only guess what’s causing it. That’s why you need to pair GA with user behavior analytics—to complete the picture and find out how users are really experiencing your site.

How to track user activity with behavior analytics

Behavior analytics is the process of tracking and analyzing quantitative and qualitative user data to identify how people interact with your website or product, and why.

Behavior analytics tools give context to the insights you get from GA by allowing you to monitor user behavior on the page directly. Using them together gives you a clearer understanding of how users experience a page so you can fix issues, optimize UX, and improve conversion rates.

Getting set up with a SaaS behavior analytics tool is just like GA: sign up, add a tracking code, and view reports. Here’s how to get started with the two most popular behavior analytics tools: heatmaps and session recordings.

Track where users click and scroll with heatmaps

<#A Hotjar scroll map (left) and move map (right)
A Hotjar scroll map (left) and move map (right)

The easiest way to track and visualize where users click, tap, and scroll is to use heatmaps.

Website heatmaps are visual representations of the most popular (red) and unpopular (blue) elements on a page, giving you an at-a-glance understanding of what people look at and ignore, which helps you identify patterns and optimize for increased engagement.

<

There are three main types of heatmap:

  • Scroll heatmaps show how far down the page users scroll, and the average fold position

  • Click heatmaps show where website visitors click (and tap on mobile)

  • Move heatmaps show how users move their mouse as they browse

When you’re ready, here’s how to set up a free heatmap on a website or single-page application (SPA) in just a few minutes:

1. Sign up for Hotjar

Hotjar (hi 👋) is easy-to-use behavior analytics software used on over 900,000 websites worldwide.

<

Sign up for Hotjar with your Google account or email address. There’s a free forever basic plan to get you started.

2. Add Hotjar’s tracking code to your website

<

You can add Hotjar’s tracking code via Google Tag Manager by pasting the javascript snippet into the <head> of every page you want to track, or by using the official Hotjar plugin on your WordPress site.

3. Create a new heatmap

<

Once you’re in the Hotjar dashboard, select “Heatmaps” from the left column, then click the green “New Heatmap” button.

<

Name your heatmap something descriptive (e.g. “product landing page”), then select a format (manual or continuous). The free plan will create a heatmap from a sample of 1000 pageviews.

<

Enter the URL of the page you want to track, and hit the “Create Heatmap” button to finish.

<

And that’s it: you can view your new Hotjar heatmap from the first recorded pageview.

It will look something like this:

<

You can view heatmaps by device (desktop, tablet, or mobile) and heatmap type (click/tap, scroll, or move).

If you want to get more insight from your heatmaps, here’s our detailed guide to creating a heatmap (including the best pages to collect data on), and how to analyze your heatmap once the data’s flowing in.

Tracking in action:

UX designers at Bannersnack, a graphic design platform, used heatmaps to track how people interact with key landing pages. Based on heatmap data, the team created an alternative design to A/B test against the old one. The new iteration led to an impressive 25% increase in sign-ups.

Tracking in action:

A landing page heatmap showing clicks before and after a redesign

UX designers at Bannersnack, a graphic design platform, used heatmaps to track how people interact with key landing pages. Based on heatmap data, the team created an alternative design to A/B test against the old one. The new iteration led to an impressive 25% increase in sign-ups.

See how users behave with session recordings

#An example Hotjar session recording showing user behavior during a session
An example Hotjar session recording showing user behavior during a session

Heatmaps are great for showing you the overall user experience on any single page, but you’ll get richer qualitative insight by looking at how individual users experience your site across several pages. And for that, you’ll need session recordings.

Session recordings (also known as user replays) are renderings of real user actions as they browse a website. Recordings show mouse movement, clicks, taps, and scrolling across multiple pages on desktop and mobile.

Have a look at a real session recording in action to see what we mean.

<

Here’s how to view session recordings on your site in a couple of steps. If you’re not already a Hotjar customer, sign up now (free forever plan available) and add the tracking code to your site.

Privacy-first tracking: Hotjar is designed to help you understand user behavior, not collect sensitive data. That’s why our session recordings are GDPR-compliant, don’t collect unnecessary information like IP addresses, and suppress all keystroke data (i.e. anything a user types in) by default. Read more about our privacy policy and how recordings work.

1. Activate Recordings on your site

<

Select the “Recordings” menu in the left column, then click the green button to set up a new recording snapshot.

2. Start recording

<

Choose your recording type (the free plan will give you a sampled snapshot of 100 recordings), and hit the “Start Recording” button.

And that’s it: you're now tracking user session activity. Once you’ve had some traffic, your Recordings dashboard will look something like this:

<#The Hotjar recordings dashboard showing users by country
The Hotjar recordings dashboard showing users by country

3. Review your Recordings

<

The final and most important step is to watch and analyze your session recordings (popcorn optional, but highly recommended 🍿).

We’ve written a detailed guide to user recording analysis that will help you save time and get maximum insight from your recordings.

Pro tip: if you’re using Google Optimize for A/B testing, you can automatically filter Hotjar Recordings by Experiment ID.

<

In the Recordings dashboard, go to Add Filter > Google Optimize and paste/select the relevant Experiment ID.

Tracking in action:

<

The Razorpay product team using Hotjar

The product design team at Razorpay, an online payment gateway, used session recordings to optimize a newly launched product: WYSIWYG payment pages. By watching how real visitors interacted with the live product, the team was able to optimize its design to improve UX:

“Session Recordings helped us understand so many different ways that people used the product. We also identified the points on the page where we could further optimize the design.” —Saurabh Soni, Product Designer at Razorpay

Take it further: combine tracking data with user feedback

Once you spot interesting or unusual user behavior in heatmaps and session recordings, ask your visitors and customers for direct feedback to learn more about why they behave the way they do (for example, why they're about to leave your site).

Even a single-question survey can give you valuable insight and lead to UX improvements and business growth.

<#The single-question survey that helped Hubspot Academy boost sign-ups by 10%
The single-question survey that helped Hubspot Academy boost sign-ups by 10%

If you’re using Hotjar, you can set up our on-site Survey tool to get instant user feedback on your website. Take a look at these survey examples to see how real companies use surveys to collect feedback, and this list of survey questions to help you figure out the best questions to ask your users.

💭 Understand your users with Hotjar

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

FAQs