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 sessions.
For help with installing your Tracking Code, check out: How to Install the Hotjar Tracking Code.
This setup will collect data from your domain and subdomains into the same Site Dashboard
This setup will collect data from your primary domain and all subdomains where you have the same Tracking Code installed into the same Site Dashboard. Also, sessions from subdomains will count towards your plan's daily session allowance. With this setup, subdomains do not need to be added as their own sites on your account.
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 user'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 user 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 user 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.
For more help with Page Targeting, visit our Configuring Site Settings Guide.
Example of tracking across domain and subdomain
If Recordings are configured to start on http://www.example.com/cart/ and from there the user 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:
Starting with: https://checkout.example.com
This would mean that Recordings will start on the cart page, but also continue on the checkout pages.