Example Scenario
Imagine your website has a URL structure like:https://example-shop.com/profile/12345/orders
Here, 12345 is a unique userId and thus personal data. According to GDPR, this often must not be sent in plain text to analytics tools.
The Solution
Add thedata-anonymize-url attribute to your existing script tag.
What is happening here?
Instead of the full URL
/profile/12345/orders, the script now sends /profile/userId/orders to the dashboard. Your statistics remain cleanly grouped, but the User ID never leaves the visitor’s browser.Functionality & Syntax
Thedata-anonymize-url attribute uses a simple pattern language to mask dynamic parts. Our script replaces the corresponding segments before the data is sent.
| Symbol | Function |
|---|---|
{placeholder} | Curly braces define a dynamic part. The content (e.g., {userId}) is displayed as text in the reports. |
* | The wildcard (“catch-all”). Everything at this position or after is ignored or masked. |
Defining Multiple Rules
If you have several different URL structures, you can simply list the rules separated by a comma.- All URLs starting with
/profile/(User IDs are masked). - URLs for order details (e.g.,
/orders/details/98765).
Real-world Examples
Mask Public Usernames
Original:
example.com/user/max-mustermannRule: data-anonymize-url="/user/{username}"Result in Dashboard: /user/{username}Order IDs in Checkout
Original:
shop.com/checkout/success/order/B-1023-4567Rule: data-anonymize-url="/checkout/success/order/{orderId}"Result in Dashboard: /checkout/success/order/{orderId}Verification & Testing
How do you know if it works? Check it directly in the browser.- Open your browser’s Developer Tools (F12).
- Switch to the Network tab.
- Load a page on your website that contains such a URL.
- Look for the request to
analytics.bchic.de. - Click on the request and look at the Payload.
The
url field in the payload should already contain the anonymized form (e.g., /profile/userId/...). If this is the case, no personal data is being transmitted.
