CNIL Proxyfication
Page location

Page location

CNIL recommendation

The deletion of all parameters contained in collected URLs (e.g. UTMs, but also URL parameters enabling internal website routing);

Solution

The idea is to remove the parameters in the URL sent in the page_location field.

A URL with parameters looks like this: https://www.addingwell.com/?gclid=Cj0KCQjwio6XBhCMARIsAC0u9aGc7gQZfDc8YvuTRIMgrR6bxatLaoc6t6qriAZm0ozMsaam6UjW

After processing, it should look like this: https://www.addingwell.com/

In order to remove the parameters from this URL, we'll create a template that returns this URL cleaned up.

To do this, go to Templates > Variable Templates > New.

In the "Info" section, we'll name the template (in this case, "Clean Page Location").

Creating Clean Page Location Template

The third tab (Code) is the code to be copied and pasted into the appropriate field.

const getEventData = require('getEventData');
const parseUrl = require('parseUrl');
const parsedUrl = parseUrl(getEventData('page_location'));
 
if (!parsedUrl) return;
 
return parsedUrl.protocol + '//' + parsedUrl.hostname + parsedUrl.pathname;
Clean Page Location Template Code

In the fourth tab (Permissions), open the "Reads event data" accordion and select "Any".

Clean Page Location Template Permissions

We can now save and close the template.

Now that we've created this variable template, we'll need to create a variable that contains this value. This variable will replace our original page_location.

Variables > New:

  • Variable name: GA4 - Page Location Cleaned > - Variable type: Clean Page Location (Template)
  • Variable type: Clean Page Location (Template name previously created)

Once this variable has been created, it must be assigned in the GA4 tag to replace the existing page_location.

  • Tags > Open the GA4 tag > Open the 'Event Parameters' section > Add this variable in the 'Parameters to Add / Edit' section.
Adding Clean Page Location Parameter

Our location page is now anonymized and no longer contains any personal information.