Google Analytics
You can integrate with Google Analytics to create custom segments based on bot and human traffic, then share data enrichment for further analysis. You can then use this to filter bot segments out of your Google Analytics dashboards, allowing your organization to make better decisions without data contamination.
You can learn how to integrate with Google Analytics with this article.
Prerequisites
- Google Tag Manager (
gtag.js
) deployed on your application - Appropriate access in Google Analytics to update your website client-side code
- Score reporting enabled and set to binary with a threshold of 100
Google Analytics configuration
To send data to GA4, you need to create custom dimensions, which let you collect and analyze custom data within Google Analytics.
You must create a custom dimension for each data type you want to share with GA4. For example, if you want to send score reporting and two data classification enrichment types, then you need to make three custom dimensions.
- Follow Google’s steps to Create user-scoped custom dimensions.
- While completing the fields to create the custom dimension, use the following:
- Dimension name: Enter a name you want to use for this dimension.
- Scope: Select User.
- Description: Provide a description if desired.
- User property: Enter a user property. You will use this value later in Client-side JavaScript integration.
- Repeat the steps for any additional custom dimensions you need.
- Follow Google’s steps to Create a custom segment using the custom dimensions you created above. We recommend creating a user segments type of segment.
Client-side JavaScript integration
HUMAN will send an asynchronous event to the client-side environment, containing the result of the bot-or-not decision, as well as any other configured enrichment data. To share this data with Google Analytics, you need to add a new function to the client-side code that receives each of these events, then passes it along to GA4 as an event with custom dimensions.
Below is an example for an implementation for:
- A custom dimension named
bot_flag
, and - A data enrichment data point named
f_id