Hotjar fully supports cross-domain tracking for subdomains. This means that as long as the same Tracking Code is installed on each of the subdomains you want to track, Hotjar tracking will work as expected. Any page that has the Hotjar Tracking Code installed will be counted towards your average daily pageviews.
Tracking subdomains
To set this up, make sure to install the same Tracking Code on all the subdomains you want to track under the same Site in Hotjar. This set up allows you to collect data from all your subdomains into one Account.
Alternatively, if you want to collect data for different subdomains separately, you can install unique Tracking Codes for each site added to your Organization. Installing individual Tracking Codes for each subdomain will separate data collected from your Site across various dashboards. More information can be found in How to Add Organizations and Sites.
You can toggle between Sites by clicking on the building icon in the top-left corner of your Hotjar dashboard.
Only admin-level team members have access to add sites
Only team members with admin access can make changes to the set up of your Hotjar account. A full explanation of our team members permissions can be found in our Team Member Permissions article.
Limitations with Recordings
Cross-domain tracking for top-level domains
Hotjar cannot track across different top-level domains, for example, going from www.example.com to www.site.com.
For Recordings, a unique identifier allows us to track a visitor's session across multiple pages. However, due to limitations designed to provide a secure browsing experience for the user, we are unable to see this identifier when a visitor moves to a different top-level domain name.
If this does occur, the current session will end and a new session will be picked up by Hotjar, causing the Recording session to end.
Starting Recordings on a specific page
We have a limitation when setting Recordings to start on a specific page when recording cross-domain.
When you set Recordings to start on a specific page, we set a session cookie for the visitor telling our script to record all subsequent pages. Since session cookies are bound to a domain, we're not able to read the cookie if the domain changes, stopping the Recording.
The current workarounds we have for this are:
- Remove the page targeting and instead record all pages on your site.
- Add additional domains to the page targeting.
Example of tracking across domain and subdomain
If Recordings are configured to start on http://www.example.com/cart/ and from there the visitor is taken to the subdomain https://checkout.example.com/, Recordings will start when you hit /cart/, but won't continue on the checkout pages.
To ensure the session is tracked across the domain and subdomain, you would need to alter your targeting rules to be:
Simple: http://www.example.com/cart/
or
Starting with: https://checkout.example.com
This would mean that Recordings will start on the cart page, but also continue on the checkout pages.