Exclude Cookiebot scan traffic from GA4
To eliminate spikes in your GA4 acquisition reports, perform steps in your sGTM container. Cookiebot itself indicates that you should create a filter for internal traffic in GA4 itself, only this doesn't always work. In your sGTM container, however, you can exclude this.
Open your GTM server container.
Go to ‘Variables’.
Create a new ‘User-defined variable’.
Give the variable the name "ip_override".
As the variable type, choose ‘Event Data’ and as ‘Key Path’, enter "ip_override".
Save this variable.
Create a new ‘User-defined variable’.
Give the variable the name "user_agent".
As the variable type, choose ‘Event Data’ and as ‘Key Path’, enter "user_agent".
Save this variable
Go to 'Triggers'.
Open your trigger for the GA4 tag.
Add the following condition to the trigger: ‘user_agent’ does not contain "Cookiebot".
Add the following condition to the trigger: ‘ip_override’ does not match RegEx "35.198.160.49|34.159.168.195|35.246.191.14|34.107.102.47|34.141.10.24|35.246.143.2|34.159.247.222|35.198.137.6|34.159.86.126|35.198.78.207"
Make sure to check this URL to check which IP adresses you add to the last condition: Cookiebot IP list. This list could have been updated by Cookiebot since publishing this helpdesk article.
Save the changes made to the trigger and publish your sGTM container.
Open your GTM server container.
Go to ‘Variables’.
Create a new ‘User-defined variable’.
Give the variable the name "ip_override".
As the variable type, choose ‘Event Data’ and as ‘Key Path’, enter "ip_override".
Save this variable.
Create a new ‘User-defined variable’.
Give the variable the name "user_agent".
As the variable type, choose ‘Event Data’ and as ‘Key Path’, enter "user_agent".
Save this variable
Go to 'Triggers'.
Open your trigger for the GA4 tag.
Add the following condition to the trigger: ‘user_agent’ does not contain "Cookiebot".
Add the following condition to the trigger: ‘ip_override’ does not match RegEx "35.198.160.49|34.159.168.195|35.246.191.14|34.107.102.47|34.141.10.24|35.246.143.2|34.159.247.222|35.198.137.6|34.159.86.126|35.198.78.207"
Make sure to check this URL to check which IP adresses you add to the last condition: Cookiebot IP list. This list could have been updated by Cookiebot since publishing this helpdesk article.
Save the changes made to the trigger and publish your sGTM container.
Updated on: 02/10/2024
Thank you!