Skip to content

:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.

1.7 KB
Raw Blame
{
    "name": "Language URL stripper",
    "config": [
        {
            "key": "pattern",
            "name": "Pattern",
            "type": "string",
            "default": "^/([a-z]{2})(?=/|#|\\?|$)",
            "hint": "Ininitalized with `const regexp = new RegExp($pattern)`",
            "required": true
        },
        {
            "key": "matchGroup",
            "name": "Match group",
            "type": "string",
            "default": "1",
            "hint": "Used in: `const value = regexp.match($pathname)[$matchGroup]`",
            "required": true
        },
        {
            "key": "property",
            "name": "Property",
            "type": "string",
            "default": "locale",
            "hint": "Name of the event property we will store the matched value in",
            "required": true
        },
        {
            "key": "replacePattern",
            "name": "Replacement pattern",
            "type": "string",
            "default": "^(/[a-z]{2})(/|(?=/|#|\\?|$))",
            "hint": "Initialized with `new RegExp($pattern)`, leave empty to disable path cleanup.",
            "required": true
        },
        {
            "key": "replaceKey",
            "name": "Replacement key",
            "type": "string",
            "default": "$pathname",
            "hint": "Where to store the updated path. Keep as `$pathname` to override.",
            "required": true
        },
        {
            "key": "replaceValue",
            "name": "Replacement value",
            "type": "string",
            "default": "/",
            "hint": "`properties[key] = $pathname.replace(pattern, value)`",
            "required": true
        }
    ]
}