The Google Analytics (GA) integration enables you to drill through your Google Analytics data to see your users' actual experience. In this article, you'll find use cases and a guide on setting up the two features available with this Google Analytics integration.
- What can I use the Google Analytics integration for?
- Requirements before you start using the integration
- Creating Events from Google Analytics Events
- Finding recordings of users identified in Google Analytics
- Common questions, tips, and help with the Google Analytics Integration
This integration does not support GA implementations through Google Tag Manager
This integration does not support implementations of Google Analytics through Google Tag Manager (GTM) and other tag managers. If GA is being added through GTM, the integration will not work. Google Analytics must be added to your website code directly, not through a tag manager, in order to benefit from this integration.
Common use cases for the Google Analytics integration
The following are some example use cases for the Google Analytics integration:
- You identify a behavior change in a Google Analytics user segment, such as an increase in bounce rate or a decrease in conversions. Get a complete understanding of the problem or opportunity by filtering Recordings by a user from that Google Analytics segment.
- Enhancing your Google Analytics quantitative data with the related Recordings to add support to your hypothesis for a product improvement opportunity.
- Analyze user flows by filtering Recordings with the related Events from Google Analytics, such as GA_started_checkout and GA_didnt_complete_order. Use the filtered recordings to find opportunities to optimize the user journey.
- Use Google Analytics Events to filter Heatmaps to see what's getting clicked on or ignored by users who triggered an event such as GA_cart_abandoned.
- Trigger a Survey or Feedback widget when a specific user action fires a Google Analytics event.
Requirements before you start using the integration
Before getting started, be aware of the following:
- An existing GA setup is required. See Google's Get started with Analytics article for help with this.
- If GA is being added through Google Tag Manager, the integration will not work. Google Analytics must be added to your website code directly, not through a tag manager, in order to benefit from this integration.
- Google Analytics Goals are not supported - they featured in Universal Analytics, which was retired on July 1st, 2023.
- This integration only works when events are created in GA. If events are created in GTM or elsewhere and passed to GA, these events will not be detected.
Creating Events from Google Analytics Events
Sending Google Analytics Events enables you to:
- Filter Recordings and Heatmaps by Google Analytics Events.
- Target Surveys and Feedback widgets based on Google Analytics Events.
This integration does not support events that are created in Google Tag Manager or elsewhere
Only Events created and sent through Google Analytics can be recognized by this integration. If events are created in GTM or elsewhere and passed to GA, these events will not be detected.
With your Site selected on the Integrations page, click Connect for Google Analytics if you haven't already done so.
Turn on Automatically create events.
Google Analytics Events will start to be captured and attached to session data used in Recordings and Heatmaps. You may need to allow some time to pass before captured Google Analytics Events appear in the Events filter.
Use GA events to filter session data and target Surveys and Feedback widgets.
Filtering Recordings and Heatmaps by Google Analytics Events
From your Recordings or Heatmaps page, add a new filter and select Event. Then, start typing GA_ followed by the Google Analytics event name to find the relevant event.
Targeting Surveys and Feedback Widgets using Google Analytics Events
From the Targeting Settings of your Survey or Feedback widget setup, select Specific Pages
Choose Event from the dropdown menu.
Enter GA_ followed by the Google Analytics Event name as the value for the Event targeting field.
Click Done and Activate the Survey or Feedback widget.
Find recordings of users identified in Google Analytics
Setting up this feature in Google Analytics
This section covers the initial setup of this feature, which requires some configuration inside Google Analytics. For details on using this feature, see the using this feature section below.
Visit the GA4 Admin page, click Data display in the sidebar, then click Custom definitions.
Click Create custom dimensions and define its properties.
To define the custom dimension properties, enter the following in the New custom dimension overlay:
- Dimension name: hjuid
- Scope: User
- Description: User ID
-
User property: hjuid
Select hjuid if it exists. Otherwise, manually type it in.
After entering the custom dimension properties, click Save.
Create a User explorer visualization.
If you don't have a User explorer visualization, you can create one by visiting your Explore page in Google Analytics and clicking on Template gallery. In the Template gallery, select the User explorer template. For further help with creating a User explorer visualization, see the Google Analytics guide on how to create a user explorer page.
Visit your Integrations page and enable the Google Analytics integration.
If the Google Analytics integration is not already enabled, visit your Integrations page, select your Site from the dropdown menu, then click Connect for Google Analytics.
Enable Automatically share Hotjar user IDs, and click Save.
Using this feature
See our section above covering the initial setup of this feature before trying to use it.
After enabling the GA integration, you may need to wait before following this section
After enabling the Google Analytics integration, you may need to wait for Google Analytics to receive user IDs. If you try to follow the Using this feature section below, before the user IDs have been updated in GA, you may not find the detect_user property in the User explorer.
Visit your Google Analytics Explore page, then open the User explorer visualization created earlier.
Open the User activity tab by clicking on one of the GA User Ids in the User explorer 1 tab.
If no results are appearing in the User explorer 1 tab, similar to what is shown below, then you might need to adjust your date range filter.
In the User activity tab, click the detect_user event, then copy the hjuid.
The detect_user event may not be present for all GA User Ids.
Visit your Recordings page and click Add filter.
Select the Hotjar user ID filter, then paste the hjuid copied from Google Analytics and click Apply.
This will filter your Recordings list by sessions that were captured for the user you've identified from Google Analytics.
Can I use the integration if Google Analytics is installed through Google Tag Manager?
Unfortunately, when Google Analytics (GA) is loaded via Google Tag Manager (GTM), the tracking code can't grab the GA data needed for the integration to work. You will need to add your GA tag directly to your website, rather than via GTM.
For more detail, check out Google's guide on How to add the Google tag directly to your web pages .
Can I use the integration to track events on my Shopify checkout pages?
While Shopify doesn't allow third-party scripts in the checkout, an alternative is to set up Google Analytics events for buttons like "Buy it Now" and "Checkout."
From there, with the Google Analytics Integration, you can use those events in Funnels, Global Filters, and Survey targets. For example, you can set up funnels or filters for users who clicked on the "Checkout" button and made it to the order confirmation page.