Scan your website for cookies
In development
After configuring your property, it’s time to scan your website for cookies.
Before you scan your website
Section titled “Before you scan your website”If you’re using an analytical tool like Google Analytics, it’s important to set up an internal filter before scanning to exclude Cookifi scanner traffic.
This can be done via Google Tag Manager (GTM) or directly in your gtag.js
implementation,
depending on how you’ve set up your analytics.
In this example, we’ll walk through excluding Cookifi scanner traffic from Google Analytics (GA4).
Via GTM
Section titled “Via GTM”- Go to Variables.
- Create a new URL type variable. Select Query as the component
type, and enter
traffic_type
as the query key: - Click Format value and check Convert undefined to:
- Click the + icon:
- Click the + icon again:
- Within Variable Configuration, click anywhere to choose a variable type. Scroll down and select the
Undefined value variable:
- Save the URL type variable.
- Open the Google Tag for GA4. In Configuration settings, add a new parameter
traffic_type
. For the value, insert the URL variable created above:
Voilà - you’re done and can jump to create an internal filter in GA4
Via gtag.js
(codebase implementation)
Section titled “Via gtag.js (codebase implementation)”If GA4 is implemented directly in your codebase, replace your existing script with the following:
<!-- Google tag (gtag.js) --><script async src='https://www.googletagmanager.com/gtag/js?id=G-xxxxxxxxx'></script><script>window.dataLayer = window.dataLayer || [];function gtag(){dataLayer.push(arguments);}gtag('js', new Date());
function getTrafficType() {const urlParams = new URLSearchParams(window.location.search);const trafficType = urlParams.get('traffic_type');return trafficType ? trafficType : undefined;}
gtag('config', 'G-xxxxxxxxx', {'traffic_type': getTrafficType()});</script>
Make sure to replace the G-xxxxxxxxx
placeholders on line #2 and #14 with your actual GA4
measurement ID.
Create an internal filter in GA4
Section titled “Create an internal filter in GA4”Once GA4 is receiving the traffic_type
parameter, you need to filter out scanner traffic:
- In GA4, navigate to Admin > Data collection and modification > Data filters:
- Click Create filter and select Internal traffic:
- Enter a name for the filter (e.g., Cookifi scanner), and
cookifi
for the parameter value:Make sure to activate the filter by selecting the Active filter state.
Run a scan
Section titled “Run a scan”In development
In the Cookifi admin panel, navigate to Scans and click Add:
Select the property you wish to scan. Note a valid sitemap needs to be associated with a property.
Click Run.
After scanning, Cookifi will categorise detected cookies into the appropriate categories.
You can review and modify them in the Cookies settings of your property.
The scan frequency can be adjusted in Settings.