feat(plugin-custom-enrichment): add custom enrichment plugin#1339
feat(plugin-custom-enrichment): add custom enrichment plugin#1339
Conversation
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
daniel-graham-amplitude
left a comment
There was a problem hiding this comment.
Looks good! I can't find any issues.
Dogfalo
left a comment
There was a problem hiding this comment.
no changes necessarily, but have some unanswered questions about the behavior of the plugin
There was a problem hiding this comment.
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
The plugin evaluates remotely provided JavaScript (
new Function) to modify events, which is security- and stability-sensitive if misconfigured or abused. Runtime failures are handled, but the execution surface area is broad and tied to remote configuration.Overview
Adds an experimental
@amplitude/plugin-custom-enrichment-browserpackage that subscribes to a Remote Config key (configs.analyticsSDK.browserSDK.customEnrichment) and uses the returnedbodyscript to build an event enrichment function vianew Function, applied to every event duringexecute()(with teardown unsubscribing).Exposes a new
CustomEnrichmentOptionstype from@amplitude/analytics-core, and includes comprehensive Jest coverage for success/error/empty-config paths; also makes small doc/import cleanups in the page URL enrichment plugin.Written by Cursor Bugbot for commit 7d650e8. This will update automatically on new commits. Configure here.