Commit cab425c
docs(audience): audit follow-up — README cohesion and runtime helper consumption
Follow-up to SDK-49's sample-app PR after a cross-product documentation
audit comparing the audience and pixel READMEs. Fixes a cluster of
correctness, cohesion, and DX gaps the audit flagged.
sdk/README.md:
- Add "Which Immutable event-tracking product is this?" near the top so
studios landing on either @imtbl/audience or @imtbl/pixel can pick the
right one. Cross-links to ../pixel/README.md without requiring any
change to the pixel package itself.
- Swap "identity resolution" for "player identity" in the opening tagline
so a game studio dev doesn't have to parse marketing-analytics jargon
to understand what the SDK does.
- Expand the CDN quickstart to destructure the full runtime surface
(Audience, AudienceError, AudienceEvents, IdentityType, canTrack,
canIdentify, version) so no symbol reachable in ESM is quietly absent
from the CDN snippet. Adds one short paragraph stating that the two
paths have parity.
- Replace the relative markdown link to the sample-app package with an
absolute GitHub blob URL. Relative links break on npmjs.com after
publish; studios reading the package page would have seen a dead link.
sdk-sample-app/README.md:
- Add a "Why vanilla JavaScript?" paragraph so a reviewer browsing the
monorepo understands why this sample app isn't React + Next.js + biom3
like the four sibling sdk-sample-apps. The short answer: demonstrating
<script>-tag loading is the point; a React wrapper would obscure it.
- Add a pre-release warning matching the one on sdk/README.md so the
sample app's SDK dependency status is visible on either landing page.
- Remove the fabricated `pk_imapik-test-sample` fixture key; there is no
shared fixture key. Point users at Immutable Hub to provision their
own test key instead.
- Rewrite the AudienceEvents catalogue section: both ESM and CDN now
expose the constant, so show the destructure-from-window pattern
alongside the import pattern. Explain the drift-check the sample app
runs at bootstrap.
- Rewrite the canTrack / canIdentify section the same way, and correct
a load-bearing falsehood: the previous version claimed the sample app
"gates its Identity and Alias buttons on this rule locally". It does
not — the buttons stay enabled and the handlers call canIdentify
before invoking the SDK, logging a "skipped" line when consent is
lower. The README now matches the code.
- Walkthrough step 4 includes a positional hint ("5th row in the
accordion") so readers don't hunt through 11 events.
sdk-sample-app/sample-app.js:
- Destructure AudienceEvents, canTrack, canIdentify off window.Immutable-
Audience at the top of the IIFE. Previously these weren't on the CDN
window surface and the sample app had to re-implement the consent
rules as magic strings.
- Replace three `currentConsent !== 'full'` magic-string checks in
onIdentify / onIdentifyTraits / onAlias with `!canIdentify(current-
Consent)` calls to the SDK helper. Single source of truth, semantic
log messages.
- Add a validateEventCatalogue() drift check that runs at bootstrap and
compares the local AUDIENCE_EVENTS field-metadata array's event names
against window.ImmutableAudience.AudienceEvents. Logs a `drift warn`
entry when the two lists diverge so a new SDK event doesn't silently
disappear from the Typed Events panel.
Refs SDK-49
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>1 parent c50bc33 commit cab425c
File tree
3 files changed
+133
-37
lines changed- packages/audience
- sdk-sample-app
- sdk
3 files changed
+133
-37
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
5 | 5 | | |
6 | 6 | | |
7 | 7 | | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
8 | 26 | | |
9 | 27 | | |
10 | 28 | | |
| |||
15 | 33 | | |
16 | 34 | | |
17 | 35 | | |
18 | | - | |
19 | | - | |
20 | | - | |
| 36 | + | |
21 | 37 | | |
22 | | - | |
23 | | - | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
24 | 42 | | |
25 | 43 | | |
26 | | - | |
27 | | - | |
| 44 | + | |
| 45 | + | |
28 | 46 | | |
29 | 47 | | |
30 | 48 | | |
31 | 49 | | |
32 | 50 | | |
33 | 51 | | |
34 | 52 | | |
35 | | - | |
| 53 | + | |
36 | 54 | | |
37 | 55 | | |
38 | 56 | | |
| |||
43 | 61 | | |
44 | 62 | | |
45 | 63 | | |
46 | | - | |
47 | | - | |
48 | | - | |
| 64 | + | |
49 | 65 | | |
50 | 66 | | |
| 67 | + | |
51 | 68 | | |
52 | 69 | | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
53 | 73 | | |
54 | 74 | | |
55 | 75 | | |
| |||
58 | 78 | | |
59 | 79 | | |
60 | 80 | | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
61 | 86 | | |
62 | 87 | | |
63 | 88 | | |
| |||
80 | 105 | | |
81 | 106 | | |
82 | 107 | | |
83 | | - | |
84 | | - | |
85 | | - | |
| 108 | + | |
| 109 | + | |
86 | 110 | | |
87 | 111 | | |
| 112 | + | |
88 | 113 | | |
89 | 114 | | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
90 | 118 | | |
91 | 119 | | |
92 | 120 | | |
| |||
95 | 123 | | |
96 | 124 | | |
97 | 125 | | |
98 | | - | |
99 | | - | |
100 | | - | |
101 | | - | |
102 | | - | |
103 | | - | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
104 | 137 | | |
105 | 138 | | |
106 | 139 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
15 | 15 | | |
16 | 16 | | |
17 | 17 | | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
18 | 21 | | |
19 | 22 | | |
20 | | - | |
21 | | - | |
22 | | - | |
23 | | - | |
24 | | - | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
25 | 28 | | |
26 | 29 | | |
27 | 30 | | |
| |||
303 | 306 | | |
304 | 307 | | |
305 | 308 | | |
| 309 | + | |
| 310 | + | |
| 311 | + | |
| 312 | + | |
| 313 | + | |
| 314 | + | |
| 315 | + | |
| 316 | + | |
| 317 | + | |
| 318 | + | |
| 319 | + | |
| 320 | + | |
| 321 | + | |
| 322 | + | |
| 323 | + | |
| 324 | + | |
| 325 | + | |
| 326 | + | |
| 327 | + | |
| 328 | + | |
| 329 | + | |
| 330 | + | |
| 331 | + | |
| 332 | + | |
| 333 | + | |
| 334 | + | |
| 335 | + | |
| 336 | + | |
306 | 337 | | |
307 | 338 | | |
308 | 339 | | |
309 | 340 | | |
310 | 341 | | |
311 | 342 | | |
312 | 343 | | |
| 344 | + | |
| 345 | + | |
313 | 346 | | |
314 | 347 | | |
315 | 348 | | |
| |||
558 | 591 | | |
559 | 592 | | |
560 | 593 | | |
561 | | - | |
562 | | - | |
| 594 | + | |
| 595 | + | |
563 | 596 | | |
564 | 597 | | |
565 | 598 | | |
| |||
581 | 614 | | |
582 | 615 | | |
583 | 616 | | |
584 | | - | |
585 | | - | |
| 617 | + | |
| 618 | + | |
586 | 619 | | |
587 | 620 | | |
588 | 621 | | |
| |||
602 | 635 | | |
603 | 636 | | |
604 | 637 | | |
605 | | - | |
606 | | - | |
| 638 | + | |
| 639 | + | |
607 | 640 | | |
608 | 641 | | |
609 | 642 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | | - | |
4 | | - | |
5 | | - | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
9 | 9 | | |
10 | 10 | | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
11 | 32 | | |
12 | 33 | | |
13 | 34 | | |
| |||
49 | 70 | | |
50 | 71 | | |
51 | 72 | | |
52 | | - | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
53 | 77 | | |
54 | 78 | | |
55 | 79 | | |
56 | 80 | | |
57 | 81 | | |
58 | 82 | | |
| 83 | + | |
59 | 84 | | |
60 | 85 | | |
61 | 86 | | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
62 | 92 | | |
63 | 93 | | |
64 | 94 | | |
| |||
90 | 120 | | |
91 | 121 | | |
92 | 122 | | |
93 | | - | |
94 | | - | |
| 123 | + | |
| 124 | + | |
95 | 125 | | |
96 | 126 | | |
97 | 127 | | |
| |||
0 commit comments