URL targeting allows you to start session capture for Recordings and Heatmaps when a user visits a specific URL. This article describes how to set up URL targeting, the available targeting options, and offers examples of URLs that would and wouldn’t match each of these options.
This feature is only available on our paid Observe plans and you can find our latest plans and prices on our pricing page.
For details on triggering Recordings or Heatmaps based on the URL visited, see the steps below.
How to set up URL targeting for Recordings and Heatmaps
Admin-level permissions are required to configure session capture settings for URL targeting.
You'll need to have Admin permission levels to make the changes to your session capture setup described in this section. You can check which team members have the required Admin permission level by visiting your Team page.
Visit your Sites page.
Click on the settings cog icon next to the site to be edited which will open that site's settings.
From the site settings page, click on Session targeting & tracking.
Select Start capturing sessions on specific pages or when a custom event fires and enter your match criteria.
A dropdown menu should appear, allowing you to choose a match type option alongside a text field to enter your match criteria.
- To set up targeting for Recordings and Heatmaps based on the URL visited, see the available URL targeting options section below.
Triggering Heatmaps based on Events is not currently available.
After entering the match type and match criteria, click Save Changes.
Available URL targeting options
To better understand how URL targeting works, it is good to understand the components that make up a URL. Hotjar evaluates five different URL components when it looks for targeting matches: protocol, domain, path, query strings, and fragments:
URL components are shown in the image above
Each of the URL targeting criteria can be based on one of seven match types listed below. Click on a match type to see a set of examples.
This is the default match type and is used to target a page on your site. This match type ignores any query strings and fragments and the presence or not of 'www'.
Targets a specific URL, including the protocol, which can include a query string and fragment.
Target all pages that have a URL, including the protocol, which starts with the entered text.
Target all pages that have a URL which ends in the entered text.
Target all pages which contain the entered text. This rule is case sensitive.
A regular expression, regex or regexp for short, is a unique text string for describing a search pattern.
If you're unsure where to add the targeting rules, take a look at the How to set up URL targeting for Recordings and Heatmaps section above.
Hotjar can only support the following characters
a-z, A-Z,0-9, -, ., _, /, and ~. Any other characters need to be percent-encoded.
This is the default match type and is intended to be used to target a page on your site. The match will be correct if the URL path the user is on, matches the URL path you specify. The protocol, www, query strings, and fragments are ignored if entered in the field.
Simple match - https://www.x.com/pages/
The match will be correct if the URL path, query-string and fragment the user is on match EXACTLY the ones you specify.
Exact match - https://www.x.com/pages/?x=1
The match will be correct if the URL the user is on, starts exactly as you specify it, including the protocol.
Starts with - https://www.x.com/pages/
The match will be correct if the URL the user is on, ends exactly as you specify it.
Ends with - pages/
The match will be correct if the URL the user is on, contains the text you specified.
Contains - ?x=1
|NO MATCH||https://www.x.com/pages/||The URL does not contain ?x=1|
|NO MATCH||https://www.x.com/pages/subpage||The URL does not contain ?x=1|
|Match||https://www.x.com/pages/?x=1||The URL does contain the matching criteria (?x=1)|
|Match||https://www.x.com/pages/?x=1&y=1||The URL does contain the matching criteria (?x=1)|
|Match||https://www.x.com/pages/?x=1#2||The URL does contain the matching criteria (?x=1)|
Regular Expressions (REGEX)
The match will be correct if the REGEX you create includes the URL your user visits. More about REGEX can be found How to Use Regular Expressions for URL Targeting.