Skip to content

feat(topsort): support offsite click and impression tracking#3830

Open
barbmarcio wants to merge 3 commits into
segmentio:mainfrom
barbmarcio:topsort-offsite-click-tracking
Open

feat(topsort): support offsite click and impression tracking#3830
barbmarcio wants to merge 3 commits into
segmentio:mainfrom
barbmarcio:topsort-offsite-click-tracking

Conversation

@barbmarcio

Copy link
Copy Markdown

Summary

Offsite (and organic) click and impression events could not be sent to Topsort through the Segment integration. The destination's click and impression actions marked resolvedBidId as a required field, so Segment's payload validation rejected any event without one — returning 400: The root value is missing the required field 'resolvedBidId' — even though the Topsort /v2/events API itself accepts offsite events with no resolved bid (they're attributed via entity, externalCampaignId/externalVendorId and channel: "offsite").

On top of that, there was no mapping for dsp_metadata anywhere in the actions, so customers had no way to forward the DSP click identifiers (e.g. gclid for Google, or the Meta equivalent) that Topsort needs to send offsite conversions back to Google/Meta for optimization.

Changes

  • Made resolvedBidId optional (required: false) on the click and impression actions. Onsite sponsored events continue to send it exactly as before; offsite/organic events can now omit it.
  • Added a free-form dsp_metadata object field (mapped from $.properties.dsp_metadata) to the click and impression actions. It's free-form because the accepted keys vary per advertising platform.
  • Updated/added tests to cover offsite events (no resolvedBidId, with dsp_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).
  • Lint and typecheck pass for the changed files.

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.
@barbmarcio barbmarcio requested a review from a team as a code owner June 15, 2026 15:32
…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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants