Google Tag Manager
With the ClickPatrol tag in Google Tag Manager, you can track and classify ad traffic as Legitimate or Suspicious directly on your website. These events can be used to build audiences in Google Ads or GA4, control which scripts load based on traffic type, and improve the accuracy of your campaign data.
How ClickPatrol events work in GTM#
When the ClickPatrol tag fires, it pushes a classification event to the DataLayer using a standard dataLayer.push. Events like ClickPatrol_Legitimate and ClickPatrol_Suspicious are regular DataLayer events, so a GTM Custom Event trigger can pick them up, and you can also find them in window.dataLayer and the GTM Preview event list.
Each event includes the event name, a traffic field indicating whether the visit is classified as safe or suspicious, and an audience object containing the on/off flags for the audiences configured in your ClickPatrol account. For example:
window.dataLayer = window.dataLayer || [];
window.dataLayer.push({
"event": "ClickPatrol_Legitimate",
"traffic": "safe",
"audience": { /* your configured audiences, e.g. "exclude_suspicious": false */ }
});
These events only fire for ad traffic. During testing, you need to simulate this manually. See the Testing section below.
Step 1: Import the ClickPatrol template#
- Open Google Tag Manager.
- Go to Templates and click New.
- Click Search Gallery.
- Search for ClickPatrol, or open the template directly via this gallery link.
- Click Add to workspace and confirm the required permissions.
Step 2: Create the ClickPatrol tag#
- Go to Tags and click New.
- Give the tag a name (for example, ClickPatrol Tag).
- Click Tag Configuration and select ClickPatrol Tag under Custom.
- Enter your ClickPatrol UID. Find this by going to Integration in the sidebar, opening the Google Tag Manager tab, and copying the ID shown under Your Unique ID.
Step 3: Set the trigger to All Pages#
- Click Triggering.
- Select All Pages.
- Click Save.
This ensures the ClickPatrol tag fires on every page of your website so no ad traffic is missed.
Step 4: Create a Custom Event Trigger for ClickPatrol events#
This step is required if you want to use ClickPatrol events in GA4, Google Ads audiences, or any other tag that depends on ClickPatrol's classification output.
- Go to Triggers and click New.
- Click Trigger Configuration and select Custom Event.
- Set the Event Name to ClickPatrol_.*
- Enable Use regex matching. This ensures the trigger catches all ClickPatrol event types, including ClickPatrol_Legitimate and ClickPatrol_Suspicious.
- Name the trigger (for example, ClickPatrol Event Trigger) and click Save.
Note: Without this trigger, the ClickPatrol tag will fire and classify traffic, but nothing downstream in GTM will be able to act on those events. You need this trigger to send events to GA4, build audiences, or run any conditional tag logic.
Step 5: Publish#
- Click Submit in GTM to publish the container with all your changes.
Testing the ClickPatrol event#
ClickPatrol events only fire for ad traffic. To test your setup manually, add ?source=g to your website URL:
https://www.yourwebsite.com/?source=g
To confirm the tag fires correctly:
- In GTM, click Preview (top right).
- Enter your URL with ?source=g appended and click Connect.
- In the Tag Assistant window, check the event list on the left. You should see a ClickPatrol_Legitimate or ClickPatrol_Suspicious event appear.
- Click the event and confirm that ClickPatrol Tag appears under Tags Fired.
Tip: ClickPatrol events appear both in the GTM Preview event list (left-hand side) and in window.dataLayer. You can confirm them in either place.
If the ClickPatrol tag appears under Tags Not Fired, check that:
- The tag is set to trigger on All Pages.
- You have published the container after saving your changes.
- The UID entered in the tag matches the one in your ClickPatrol Integration settings.
Was this article helpful?
Let us know so we can improve our documentation
Need Help?
If something isn't working or you have questions, our support team is here to help you.
Contact Support