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

  1. In Google Analytics, navigate to the Admin section and select Custom Definitions.
    unknown.png
  2. Click the New Custom Dimension button.
  3. 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

Edit Custom Dimension.png
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.

  1. Under Personal Tools & Assets, click Segment and then New Segment.
  2. Under Advanced, select Conditions.
  3. 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
    unknown.png
  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
    Traffic Sources.png

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

  1. In Google Analytics, navigate to the Admin section and select Custom Definitions.
    unknown.png
  2. Click the New Custom Dimension button.
  3. 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.
    A Creating  custom dimension with a high number of unique.png
  4. 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:

  1. Open the Explorations tab.
    Explorations.png
  2. On the Variables sidebar, click + next to Segments to create a new segment.
    Variables.png
  3. Create a User Segment.
    Set the logic to match your custom dimension, as shown below.
    unknown.png
  4. Add a title and click Save and Apply.

Alternatively, you can configure a segment that excludes the bot traffic, using the same logic.