How to install Hotjar tracking code on WordPress
Installing Hotjar tracking code on WordPress requires copying your unique tracking script from Hotjar dashboard and adding it to your site's header. You can do this through WordPress plugins, theme editor, or manually adding the code to your theme's functions.php file.
Prerequisites
- Active Hotjar account
- WordPress admin access
- Basic understanding of WordPress dashboard
- Site with SSL certificate (HTTPS)
Step-by-Step Instructions
Log into your Hotjar account and locate tracking code
hotjar.com. Navigate to Sites & Organizations in the left sidebar, then click on your website. Select Tracking Code from the site settings menu. Copy the complete tracking script that starts with <script> and ends with </script>.Access your WordPress admin dashboard
yoursite.com/wp-admin. Enter your admin credentials to access the dashboard. You'll need administrator privileges to install tracking codes.Choose your installation method
- Plugin method: Install a header/footer plugin like "Insert Headers and Footers"
- Theme customizer: Use WordPress built-in customizer if your theme supports it
- Manual method: Edit your theme's header.php file directly
Install and configure header plugin (recommended method)
Add Hotjar tracking code to header section
Verify installation in Hotjar dashboard
Test tracking functionality
Common Issues & Troubleshooting
Hotjar shows 'Not Receiving Data' status after installation
Wait up to 30 minutes for data to appear. If still not working, check that the tracking code is in the <head> section of your site, clear any caching plugins, and ensure your site has HTTPS enabled.
Tracking code disappears after theme updates
This happens when code is added directly to theme files. Switch to using a plugin like "Insert Headers and Footers" or add the code to a child theme's functions.php file to prevent loss during updates.
Site loading slowly after installing Hotjar
Ensure you're using the latest Hotjar tracking code which loads asynchronously. Check with your hosting provider about server performance and consider using a caching plugin to improve overall site speed.
WordPress editor shows 'Unable to communicate back with site' error
This can occur when adding tracking code incorrectly. Remove the Hotjar code temporarily, check for any syntax errors, and re-add it. If using the theme editor, ensure you have a backup of your original files.