Send ClickPatrol audience values to GA4

In GA4 · Updated (2 hours ago)

Besides sending the ClickPatrol event name to GA4, you can also send the audience values that are included inside the ClickPatrol event. This is useful when you want to use specific ClickPatrol audiences in GA4 reports, Explorations, or audience conditions.

Before you start, make sure the ClickPatrol tag is firing in Google Tag Manager and that your GA4 Event tag (the tag that sends ClickPatrol events to GA4) is already set up. If you have not installed the tag yet, start with the Google Tag Manager article.

A ClickPatrol event can contain an audience object like this:

window.dataLayer = window.dataLayer || [];
window.dataLayer.push({
  "event": "ClickPatrol_Legitimate",
  "traffic": "safe",
  "audience": {
    "cpsuspicioustrafficnl": false,
    "cplegitimatetrafficnl": false
  }
});

In this example, the audience values are:

audience.cpsuspicioustrafficnl = false
audience.cplegitimatetrafficnl = false

To send these values to GA4, you first need to create Data Layer Variables in Google Tag Manager.

Create Data Layer Variables for audience values#

In Google Tag Manager, go to Variables → User Defined Variables → New and choose Data Layer Variable. Create one variable for each audience value you want to send to GA4.

For the suspicious traffic audience:

  • Name: DLV - CP Suspicious Traffic NL
  • Data Layer Variable Name: audience.cpsuspicioustrafficnl
  • Data Layer Version: Version 2

And for the legitimate traffic audience:

  • Name: DLV - CP Legitimate Traffic NL
  • Data Layer Variable Name: audience.cplegitimatetrafficnl
  • Data Layer Version: Version 2

Because these values are inside the audience object, use dot notation in the Data Layer Variable Name.

Add the audience values as GA4 event parameters#

After creating the Data Layer Variables, open your ClickPatrol GA4 Event tag. This is the GA4 Event tag that sends ClickPatrol events to GA4.

Under Event Parameters, add the audience values you want to send. For example:

Event parameter Value
cp_suspicious_traffic_nl {{DLV - CP Suspicious Traffic NL}}
cp_legitimate_traffic_nl {{DLV - CP Legitimate Traffic NL}}
Tip

You can use your own naming convention for the GA4 event parameters, but we recommend clear names that are easy to recognize in GA4. For example, instead of sending cpsuspicioustrafficnl, use cp_suspicious_traffic_nl. This makes the values easier to understand later in GA4 reports and audience conditions.

Test the audience values#

Before publishing the changes, test your setup in Google Tag Manager Preview mode.

  1. Open Google Tag Manager.
  2. Click Preview.
  3. Visit your website.
  4. Trigger a ClickPatrol event.
  5. Select the ClickPatrol event in Tag Assistant.
  6. Open the GA4 Event tag.
  7. Check whether the audience parameters are filled correctly.

For the example event above, you should see values like:

cp_suspicious_traffic_nl = false
cp_legitimate_traffic_nl = false

Note: if a value shows as undefined, check whether the Data Layer Variable name matches the audience key exactly. For nested audience values, the format should be audience.audience_name, for example audience.cpsuspicioustrafficnl.

Register audience parameters as custom dimensions in GA4#

GA4 can collect event parameters, but if you want to use them in standard reports or Explorations, you need to register them as custom dimensions.

In GA4, go to Admin → Custom definitions → Create custom dimension and create a custom dimension for each audience parameter.

For the suspicious traffic audience:

  • Dimension name: CP Suspicious Traffic NL
  • Scope: Event
  • Event parameter: cp_suspicious_traffic_nl

And for the legitimate traffic audience:

  • Dimension name: CP Legitimate Traffic NL
  • Scope: Event
  • Event parameter: cp_legitimate_traffic_nl

After this, the ClickPatrol audience values can be used in GA4 reports, Explorations, and audience conditions.

Result#

After completing this setup, GA4 will not only receive the ClickPatrol event name, but also the ClickPatrol audience values inside that event. For example:

Event name: ClickPatrol_Legitimate

Event parameters:
cp_suspicious_traffic_nl = false
cp_legitimate_traffic_nl = false

This gives you more control when building GA4 audiences based on ClickPatrol audience logic.

Next steps#

Once your ClickPatrol audience values are flowing into GA4, you can use them to build audiences and share them with your advertising platforms:

Was this article helpful?

Let us know so we can improve our documentation

Thanks for your feedback!

Need Help?

If something isn't working or you have questions, our support team is here to help you.

Contact Support