feat(topsort): support offsite click and impression tracking#3830
Open
barbmarcio wants to merge 3 commits into
Open
feat(topsort): support offsite click and impression tracking#3830barbmarcio wants to merge 3 commits into
barbmarcio wants to merge 3 commits into
Conversation
Make resolvedBidId optional and add a dsp_metadata field to the Topsort click and impression actions so offsite (and organic) events can be sent via Segment. Previously resolvedBidId was required by the destination's payload validation, which rejected offsite events that legitimately have no resolved bid, and there was no mapping for dsp_metadata at all.
agustinespildora
suggested changes
Jun 15, 2026
…trings Address PR review: rename the dsp_metadata mapping field to dspMetadata (camelCase, matching codebase convention) while still sending dsp_metadata in the API payload. Add NormalizeDspMetadata to coerce non-string values to strings, since the Report Events API expects a map of string to string and a single non-string value would otherwise 422 the whole batch.
agustinespildora
approved these changes
Jun 16, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Offsite (and organic) click and impression events could not be sent to Topsort through the Segment integration. The destination's
clickandimpressionactions markedresolvedBidIdas a required field, so Segment's payload validation rejected any event without one — returning400: The root value is missing the required field 'resolvedBidId'— even though the Topsort/v2/eventsAPI itself accepts offsite events with no resolved bid (they're attributed viaentity,externalCampaignId/externalVendorIdandchannel: "offsite").On top of that, there was no mapping for
dsp_metadataanywhere in the actions, so customers had no way to forward the DSP click identifiers (e.g.gclidfor Google, or the Meta equivalent) that Topsort needs to send offsite conversions back to Google/Meta for optimization.Changes
resolvedBidIdoptional (required: false) on theclickandimpressionactions. Onsite sponsored events continue to send it exactly as before; offsite/organic events can now omit it.dsp_metadataobject field (mapped from$.properties.dsp_metadata) to theclickandimpressionactions. It's free-form because the accepted keys vary per advertising platform.resolvedBidId, withdsp_metadata) and regenerated types and snapshots.This is a non-breaking change — it only loosens an existing constraint and adds a new optional field. No existing onsite mappings are affected.
Testing
yarn cloud jest --testPathPattern="topsort"— all 10 suites pass (32 tests).