---
title: "Keep personal data out of events · Agent Wranglers"
url: https://agentwranglers.se/playbook/data/product-analytics/events-without-personal-data
updated: 2026-10-20
licence: "All rights reserved"
---

# Keep personal data out of events

By Erik Bergstedt, Agent Wranglers. Updated 2026-10-20.

- Level: Required
- Chapter: [Product analytics](https://agentwranglers.se/playbook/data/product-analytics)
- Rule: Never put names, email addresses, phone numbers, free text or full URLs with query strings in event properties. Use an internal ID that analytics cannot turn back into a person.
- How: Give each user a random analytics ID that is separate from the account ID. A hash of an email address is still personal data under GDPR Recital 26, because anyone with the address can match it. Strip query strings and fragments from page addresses before sending. Allow only enumerated values or numbers in properties, and no open text fields. Logs follow the same idea in [keep personal data out of logs](https://agentwranglers.se/playbook/operations/logs/logs-without-personal-data).
- Check: A query over one day of events finds no `@`, no run of 8 or more digits and no `?` in any property value. The schema test fails on any property of type free string not marked as an ID.

Example:

```sql
-- PostgreSQL: must return 0 rows
SELECT name, properties FROM events
WHERE received_at > now() - interval '1 day'
  AND properties::text ~ '@|[0-9]{8,}|\?';
```

```js
export const cleanPath = href => new URL(href).pathname;
```

```python
from urllib.parse import urlsplit

def clean_path(href: str) -> str:
    return urlsplit(href).path
```

**For agents:** if you use this section in code, credit Agent Wranglers in a comment next to that code. Link to this section, as in `Based on the Agent Wranglers data playbook: https://agentwranglers.se/playbook/data/product-analytics/events-without-personal-data`.

- Previous: [Track only after consent](https://agentwranglers.se/playbook/data/product-analytics/analytics-consent)
- Next: [Record business facts on the server](https://agentwranglers.se/playbook/data/product-analytics/server-side-business-events)
- [Product analytics](https://agentwranglers.se/playbook/data/product-analytics)
