For AI agents: a documentation index is available at /docs/llms.txt. Append .md to any page URL for markdown, or send Accept: text/markdown.
Filter sensitive URL content
Configure ugcFilterRules to replace sensitive user-generated content in URLs before the SDK records URLs in replays and heatmaps. Use web masking settings to protect page text and form inputs.
- Identify URLs that contain sensitive user IDs, company names, query parameters, or dynamic path segments.
- Choose selectors and descriptive replacement URLs using the UGC Filter Rules reference.
- Put specific rules before general rules. The SDK uses the first matching rule.
- Add the rules to
interactionConfigduring SDK initialization and setenabled: true.
Configure UGC Filter Rules
Configure UGC Filter Rules as part of the interactionConfig when initializing Session Replay. The Standalone SDK, the Browser SDK plugin, and the sessionReplay options of the Unified SDK all accept the same interactionConfig object.
import * as amplitude from "@amplitude/analytics-browser";
import { sessionReplayPlugin } from "@amplitude/plugin-session-replay-browser";
amplitude.add(
sessionReplayPlugin({
interactionConfig: {
enabled: true,
ugcFilterRules: [
{
selector: "https://example.com/user/*/profile",
replacement: "https://example.com/user/USER_ID/profile",
},
],
},
}),
);
amplitude.init("YOUR_API_KEY");
Test patterns in a development environment first
Validate that your glob patterns match expected URLs in a development environment. The following array lists example URLs to include in your checks; it doesn't execute a test:
// Test with various URL formats
const testUrls = [
"https://mycompany.projecttool.com/browse/PROJ-123",
"https://codehost.com/username/repository/tree/main/src/components",
"https://myapp.com/user/john.doe@email.com/profile",
];
Was this helpful?