Skip to content

fix(vega): suppress generic web billing events on vega - #1097

Open
fire-at-will wants to merge 2 commits into
vega-devfrom
suppress-web-billing-events-on-vega
Open

fix(vega): suppress generic web billing events on vega#1097
fire-at-will wants to merge 2 commits into
vega-devfrom
suppress-web-billing-events-on-vega

Conversation

@fire-at-will

@fire-at-will fire-at-will commented Aug 27, 2026

Copy link
Copy Markdown
Contributor

Motivation / Description

The JS SDK emits many events that are web-billing specific, and that the backend classifies as RCBilling events. We were incorrectly emitting these events when running on Vega. This caused events to be emitted by Vega apps that got classified as web billing events by the backend.

Changes introduced

Prevents the SDK from emitting generic web billing events (including sdk_initialized) when the SDK is initialized with an Amazon API key. Paywall events are still emitted, as they aren't classified as web billing events in the backend.


Note

Low Risk
Analytics-only behavior gated on API key prefix; purchase and paywall event paths are explicitly preserved in tests.

Overview
Stops generic web billing analytics (e.g. sdk_initialized, external/SDK web_billing events) when EventsTracker is constructed with an Amazon API key (isAmazonApiKey), so Vega apps no longer send events the backend misclassifies as RCBilling.

The guard lives in private trackEvent via a new suppressGenericEvents flag set in the constructor. Paywall and custom paywall impression events are unchanged and still flush to /v1/events.

Tests replace the old Amazon X-Platform header expectation with coverage that generic tracking is skipped while paywall paths still post, plus a Purchases.configure case asserting no sdk_initialized for amzn_valid_key.

Reviewed by Cursor Bugbot for commit cd13f18. Bugbot is set up for automated code reviews on this repo. Configure here.

@fire-at-will
fire-at-will requested a review from a team as a code owner August 27, 2026 14:42

@tonidero tonidero left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would love for the web team to take a look at this. On my side just a couple questions 🙏

Logger.verboseLog("Skipping event tracking, the EventsTracker is silent");
return;
}
if (this.suppressGenericEvents) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm I would say the proper fix is probably to pass the store or something like that in these events instead... Do we plan to do something like that as a follow-up?

this.eventsUrl = `${props.httpConfig?.eventsURL ?? RC_ANALYTICS_ENDPOINT}/v1/events`;
this.appUserId = props.appUserId;
this.isSilent = props.silent || false;
this.suppressGenericEvents = isAmazonApiKey(props.apiKey);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FWIW, not sure if we should also have these events in stripe/paddle/test store... But maybe a question for @james-od @nicfix ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants