Posthog URL Anonymizer 🚓
A Posthog Plugin that anonymizes URLs stored by default in PostHog by removing any 0x hash.
Check out the NPM Package here 🚀
NOTE: Any properties already defined for a user by $set_once
cannot be overwritten by this plugin.
Getting Started
yarn
yarn build
Plugin Options
The list of properties censored by the plugin can be configured directly from the PostHog UI.
{
"key": "properties",
"name": "List of properties to censor",
"type": "string",
"default": "$current_url,$referrer,$pathname,$initial_current_url,initial_pathname,initial_referrer",
"hint": "Separate properties with commas, without using spaces, like so: `foo,bar,$baz`",
"required": false
},
{
"key": "set_properties",
"name": "List of $set properties to censor",
"type": "string",
"default": "$initial_current_url,$initial_pathname,$initial_referrer",
"hint": "Separate properties with commas, without using spaces, like so: `foo,bar,$baz`",
"required": false
},
{
"key": "set_once_properties",
"name": "List of $set_once properties to censor",
"type": "string",
"default": "$initial_current_url,$initial_pathname,$initial_referrer",
"hint": "Separate properties with commas, without using spaces, like so: `foo,bar,$baz`",
"required": false
}
Example Usage
0x
hashes in the configured fields are replaced with *CENSORED*
to protect user privacy:
{
"id": "01831bde-f028-0000-a74b-b54240f6bc36",
"timestamp": "2022-09-08T06:52:16.717000+00:00",
"event": "SendTransferSuccessful",
"distinct_id": "1831bc78b2518e1-0d86dca00e33-1b525635-232800-1831bc78b262949",
"properties": {
"$browser": "Chrome",
"$browser_version": 104,
"$current_url": "http://localhost:3000/account/0x*CENSORED*/send",
"$device_id": "1831bc78b2518e1-0d86dca00e33-1b525635-232800-1831bc78b262949",
"$device_type": "Desktop",
"$feature/test-feature-flag": true,
"$host": "localhost:3000",
"$insert_id": "hyeaukq2j9ekhb7e",
"$lib": "web",
"$lib_version": "1.29.3",
"$os": "Mac OS X",
"$pathname": "/account/0x*CENSORED*/send",
"$referrer": "http://localhost:3000/account/0x*CENSORED*",
"$referring_domain": "localhost:3000",
"$screen_height": 1200,
"$screen_width": 1920,
"$session_id": "1831bc78b3a1503-0624c19c138e3f-1b525635-232800-1831bc78b3b2dd1",
"$set": {},
"$set_once": {
"$initial_os": "Mac OS X",
"$initial_browser": "Chrome",
"$initial_device_type": "Desktop",
"$initial_current_url": "http://localhost:3000/account/0x*CENSORED*/send",
"$initial_pathname": "/account/0x*CENSORED*/send",
"$initial_browser_version": 104,
"$initial_referrer": "http://localhost:3000/account/0x*CENSORED*",
"$initial_referring_domain": "localhost:3000"
},
"$time": 1662619936.68,
"$viewport_height": 1096,
"$viewport_width": 1444,
"$window_id": "1831bc78b3c3561-08cec966d9a314-1b525635-232800-1831bc78b3d3550",
"distinct_id": "1831bc78b2518e1-0d86dca00e33-1b525635-232800-1831bc78b262949",
"installedWallets": ["CORE"],
"selectedWallet": "CORE",
"token": "phc_PSAHPcUlVU1xHIwAtYUq17xQ7TGprkEzgqzaBWd5DjS"
},
"elements_chain": ""
}