feat(audience-quickstart): add drop-in QuickStart sample (SDK-229)#704
Closed
ImmutableJeffrey wants to merge 2 commits into
Closed
feat(audience-quickstart): add drop-in QuickStart sample (SDK-229)#704ImmutableJeffrey wants to merge 2 commits into
ImmutableJeffrey wants to merge 2 commits into
Conversation
…...]} envelope
Two bugs that together kept the QuickStart sample from ever shipping
events successfully:
1. The 4xx branch of SendBatchAsync reported only the status code.
Now reads response.Content (truncated to 500 chars) so the
backend's validation message lands in the onError callback —
no more silently dropped batches with "something is wrong" as
the only signal.
2. BuildPayload wrapped events in {"batch":[...]}. The backend's
MessagesRequest schema expects the top-level key "messages";
every send 400'd. Envelope switched, tests updated, and the
GzipTests fixture aligned to the real wire shape.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
…DK API (SDK-49)
Adds a Samples/QuickStart folder (no tilde — Unity auto-includes it
when the package is installed). Drop AudienceDemo on any GameObject
or open the bundled scene, set the publishable key, press Play.
IMGUI overlay (zero scene setup):
- Boxed SDK-status panel reads the public diagnostic getters live
(Init, Environment, Consent, Pub key, User ID, Anon ID, Session
ID, Queued). Full GUIDs; Copy buttons write raw values to the
system clipboard. Pub key row flags the REPLACE_ME placeholder
in red so misconfiguration is obvious before the backend 401s.
- Sections: SDK lifecycle (Init / Shutdown / Flush), Typed events,
Custom event, Identity, Privacy consent, Advanced (GDPR erasure).
Each has a plain-English description so a zero-context reader
understands what the buttons do without opening source.
- Two-line buttons: action sentence on top ("Player started a
level"), SDK API in parens below ("(Progression.Start)").
- Buttons gate on live SDK state — Track-family disables below
Consent.None, Identify/Alias require Full consent, each Consent
button disables at its own level, Init enables only when not
initialised, Shutdown/Flush/Delete only when initialised.
- No auto-init: user presses Start the SDK explicitly; every
SDK-dependent button stays disabled until they do.
- Panel caps at 800px and centres horizontally so it reads as a
focused card on wide screens and fills narrow Game views.
Sample payloads use familiar fantasy terminology (overworld,
stone_age, gold, diamond_sword, dragon_defeated) — cold-readable
without gaming background, replaced during integration.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
nattb8
reviewed
Apr 24, 2026
Collaborator
nattb8
left a comment
There was a problem hiding this comment.
Is it supposed to be Samples~/
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
Adds a
Samples/QuickStartfolder containingAudienceDemo.cs— a drop-in MonoBehaviour that exercises every publicImmutableAudienceAPI from an IMGUI overlay. Studios can set a publishable key, press Play, and verify their audience pipeline end-to-end without wiring a Canvas or prefab.IMGUI overlay
Initialized,Environment,Consent,Pub key,UserId,AnonymousId,SessionId,Queued). Full GUIDs render without truncation; a Copy button next to each ID writes the raw value to the system clipboard. ThePub keyrow highlights theREPLACE_MEplaceholder in red so misconfiguration is obvious before the backend returns 401.Consent.None;Identify/AliasrequireConsent.Full; each Consent button disables at its own level;Initenables only when the SDK is not initialised;Shutdown/Flush/Deleteenable only when it is.Bundled scene
AudienceDemo.unityis a minimal scene with a camera, a light, and one GameObject carryingAudienceDemo. The overlay renders entirely through IMGUI so the scene has no dependency on a specific uGUI or UI Toolkit version.Sample payloads
overworld,stone_age,gold,diamond_sword,dragon_defeated) — cold-readable without gaming background. Studios replace these strings with their own world names, currencies, item ids, and milestones during integration.Transport fixes (bundled)
HttpTransportreports backend response body on 4xx so the validation message reachesonErrorinstead of being dropped.MessagesRequestschema.Linear: SDK-229
Note
Medium Risk
Touches the event flush transport by changing the request envelope to
{"messages":[...]}and surfacing 4xx response bodies, which could impact backend compatibility and error reporting behavior if assumptions differ. Sample additions are low risk but increase package surface area.Overview
Adds a drop-in QuickStart Unity sample (
Samples/QuickStart) including anAudienceDemoIMGUI overlay and a minimal.unityscene, letting studios initialize the SDK, send representative events, manage identity/consent, and trigger flush/GDPR deletion without building UI.Updates
HttpTransportto (1) wrap queued events under{"messages":[...]}instead of{"batch":[...]}and (2) include the backend’s 4xx response body (truncated) inValidationRejectederrors for more actionable diagnostics; associated unit tests and gzip test payloads are updated accordingly.Reviewed by Cursor Bugbot for commit 99bf8c2. Bugbot is set up for automated code reviews on this repo. Configure here.