Google Analytics Configuration
In order to send Bot Defender data to Google Analytics, custom dimensions must first be configured within Google Analytics. Custom dimensions are used to collect and analyze data in Google Analytics that isn't already automatically tracked. You can read more about this feature in Google's documentation here.
You must create one custom dimension for each datapoint you want to share with Google Analytics. If you are using the integration to track data enrichment parameters, you will need to create a custom dimension for each parameter you wish to track.
Universal Analytics
Creating a Custom Dimension in Google Analytics
- In Google Analytics, navigate to the Admin section and select Custom Definitions.
- Click the New Custom Dimension button.
- Create a new custom dimension with the below values.
- Name: Human Bot Flag. You may use any string you want for the Name as long as it is unique.
- Scope: Session. This applies the dimension to the entire user (or bot) session, and is the recommended way to configure the dimension. See Google's documentation on Session-level scope for more information.
- Active box: Checked
4. Take note of the dimension index in the example code (e.g. dimension1
). You will need this value if your Google Analytics uses multiple custom dimensions.
5. Save the new dimension.
Creating Custom Segments
To slice traffic in any reports and dashboards, create two new segments: Bot Segment ​and Clean Segment.
- Under Personal Tools & Assets, click Segment and then New Segment.
- Under Advanced, select Conditions.
- Create a new segment called Bot Segment:
- Name: Bot Segment
- Filter: Sessions
- From the drop down select: Human Bot Flag
- Condition: Exactly Matches
- Value: 1
- Create an additional new parameter called Clean Segment.
- Name: Clean Segment
- Filter: Sessions
- From the drop down select: Human Bot Flag
- Condition: Exactly Matches
- Value: 0
Google Analytics 4
Data can be sent from Bot Defender to Google Analytics 4 (GA4) in a few ways. Here we explain how to configure it as a custom dimension with User scope.
Creating a Custom Dimension
- In Google Analytics, navigate to the Admin section and select Custom Definitions.
- Click the New Custom Dimension button.
- Create a new custom dimension. Make sure to set the scope to User. The value you set in User property will be used in your client-side code.
- Click Save.
Creating a Custom Segment
GA4 supports multiple ways to view the data within the dashboard. One way to view it is to create a custom segment.
TO create a custom segment:
- Open the Explorations tab.
- On the Variables sidebar, click + next to Segments to create a new segment.
- Create a User Segment.
Set the logic to match your custom dimension, as shown below.
- Add a title and click Save and Apply.
Alternatively, you can configure a segment that excludes the bot traffic, using the same logic.
Updated 12 days ago