This article explains the different matching options that Hotjar uses when evaluating pages on your website. These rules are true for both targeting and Recording filters.
When you're ready to choose your Recordings targeting settings, check out the article below that corresponds with your Hotjar plan:
- Basic plan: How to Start and Stop Recordings
- Plus or Business plans: Configuring Site Settings: Session Targeting and Tracking
Using page targeting rules may prevent Hotjar from collecting Recordings up to your daily Recording limit.
If your site is experiencing sampling, page targeting rules may result in fewer recordings being captured than your daily limit. We strongly recommend removing the Hotjar Tracking Code from pages you do not wish to track if your site receives high levels of traffic on those pages.
URL targeting
To better understand how URL targeting works, it is good to also understand what components form a URL:
Components of a URL
Each URL match you enter can be one of 6 types as well as a target based on a Javascript trigger:
- Simple match: This is the default match type and is used to target a page on your site, ignoring any query strings and fragments as well as protocol (http vs. https), and the presence or not of 'www'.
- Exact match: Targets a specific URL, including the protocol, which can include a query string and fragment.
- Starts with: Target all pages that have a URL, including the protocol, which starts with the entered text;
- Ends with: Target all pages that have a URL which ends in the entered text;
- Contains: Target all pages which contain the entered text. This rule is case sensitive;
- Regular Expression: A regular expression, regex or regexp for short, is a unique text string for describing a search pattern.
- JavaScript: Available on our Plus and Business plan, this method targets actions taken by a visitor to trigger a Recording. Learn how to set up JavaScript Triggers.
For information on how to set up page targeting for Recordings, head to How to Start and Stop Recordings.
Hotjar can only support the following characters
a-z, A-Z,0-9, -, ., _, /, and ~. Any other characters need to be percent-encoded.
Simple match
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 your visitor is on, matches the URL path you specify.
Query strings and fragments are ignored if entered in the field.
Example:
Simple Match - http://www.x.com/pages/
Result | Example URL | Why? |
MATCH | http://www.x.com/pages/ | The domain (x.com) and page path (/pages) is a match |
NO MATCH | http://www.x.com/pages/subpage | /subpage is not part of the page path criteria |
MATCH | http://www.x.com/pages/?x=1 | The query string (?x=1) is ignored |
MATCH | http://www.x.com/pages/?x=1&y=1 | The query string (?x=1&y=1) is ignored |
MATCH | http://www.x.com/PAGES | The Simple Match method is NOT case sensitive |
MATCH | https://www.x.com/pages/ | The HTTPS protocol is ignored |
MATCH | http://x.com/pages | The www. prefix to the domain is ignored |
MATCH | https://x.com/pages/ | The HTTPS and www. prefix to the domain are ignored |
Exact match
The match will be correct if the URL path, query-string and fragment your visitor is on match EXACTLY the ones you specify.
Example:
Exact match - http://www.x.com/pages/?x=1
Result | Example URL | Why? |
NO MATCH | http://www.x.com/pages/ | The required query string (?x=1) is missing |
NO MATCH | http://www.x.com/pages/subpage | The required query string (?x=1) is missing and the page path should not include /subpage |
MATCH | http://www.x.com/pages/?x=1 | All URL components are an exact match |
NO MATCH | http://www.x.com/pages/?x=1&y=1 | The URL has a non-matching query string (&y=1) at the end of it |
NO MATCH | http://www.x.com/pages/?x=1#2 | The URL has a non-matching URL fragment (#2) at the end of it |
NO MATCH | https://www.x.com/pages/?x=1 | The URL protocol (HTTPS) needs to be changed to HTTP to become an exact match. |
Starts with
The match will be correct if the URL your visitor is on, starts exactly as you specify it, including the protocol.
Example:
Starts with - http://www.x.com/pages/
Result | Example URL |
MATCH | http://www.x.com/pages/ |
MATCH | http://www.x.com/pages/subpage |
MATCH | http://www.x.com/pages/?x=1 |
MATCH | http://www.x.com/pages/?x=1&y=1 |
MATCH | http://www.x.com/pages/?x=1#2 |
NO MATCH | https://www.x.com/pages/ |
Ends with
The match will be correct if the URL your visitor is on, ends exactly as you specify it.
Example:
Ends with - pages/
Result | Example URL |
MATCH | http://www.x.com/pages/ |
NO MATCH | http://www.x.com/pages/subpage |
NO MATCH | http://www.x.com/pages/?x=1 |
NO MATCH | http://www.x.com/pages/?x=1&y=1 |
NO MATCH | http://www.x.com/pages/?x=1#2 |
Contains
The match will be correct if the URL your visitor is on, contains the text you specified.
Example:
Contains - ?x=1
Result | Example URL |
NO MATCH | http://www.x.com/pages/ |
NO MATCH | http://www.x.com/pages/subpage |
MATCH | http://www.x.com/pages/?x=1 |
MATCH | http://www.x.com/pages/?x=1&y=1 |
MATCH | http://www.x.com/pages/?x=1#2 |
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 Page Targeting.