-
Notifications
You must be signed in to change notification settings - Fork 60
feat(plugin-custom-enrichment): add custom enrichment plugin #1339
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
| // Fetch remote config for custom enrichment in a non-blocking manner | ||
| if (config.fetchRemoteConfig) { | ||
| if (!config.remoteConfigClient) { | ||
| // TODO(xinyi): Diagnostics.recordEvent |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we resolve this TODO somehow?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hmm I just copied this over from autocapture-plugin.ts - felt like it made sense to preserve it given the similar logic to fetch the remote config.
packages/plugin-custom-enrichment-browser/src/custom-enrichment.ts
Outdated
Show resolved
Hide resolved
packages/plugin-custom-enrichment-browser/src/custom-enrichment.ts
Outdated
Show resolved
Hide resolved
packages/plugin-custom-enrichment-browser/src/custom-enrichment.ts
Outdated
Show resolved
Hide resolved
Add browser
|
packages/plugin-custom-enrichment-browser/src/custom-enrichment.ts
Outdated
Show resolved
Hide resolved
packages/plugin-custom-enrichment-browser/src/custom-enrichment.ts
Outdated
Show resolved
Hide resolved
packages/plugin-custom-enrichment-browser/src/custom-enrichment.ts
Outdated
Show resolved
Hide resolved
packages/plugin-custom-enrichment-browser/src/custom-enrichment.ts
Outdated
Show resolved
Hide resolved
packages/plugin-custom-enrichment-browser/src/custom-enrichment.ts
Outdated
Show resolved
Hide resolved
packages/plugin-custom-enrichment-browser/src/custom-enrichment.ts
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
Bugbot Autofix is OFF. To automatically fix reported issues with Cloud Agents, enable Autofix in the Cursor dashboard.
Summary
This adds the custom enrichment plugin, which users can use to run their own code on properties, when they have remote config appropriately configured.
Pending backend and frontend work on the Amplitude side. Not ready for merge yet.
Checklist
Note
High Risk
Introduces dynamic execution of remote-config-provided JavaScript via
new Function, which is security-sensitive and can impact event integrity/PII if misconfigured or compromised.Overview
Adds a new browser plugin
@amplitude/plugin-custom-enrichment-browserthat subscribes to a remote config key and, when present, compiles and runs a user-provided script to mutate events during the enrichment phase (with error handling and teardown unsubscribe).Exposes a new
CustomEnrichmentOptionstype from@amplitude/analytics-core, adds full package build/test scaffolding + docs for the new plugin, and makes a small type-only import cleanup in the page URL enrichment plugin.Written by Cursor Bugbot for commit effc900. This will update automatically on new commits. Configure here.