Skip to content

feat(audience): scaffold @imtbl/pixel package with attribution, loader, and snippet#2829

Merged
nattb8 merged 4 commits intomainfrom
SDK-50-pixel-package-scaffold
Apr 7, 2026
Merged

feat(audience): scaffold @imtbl/pixel package with attribution, loader, and snippet#2829
nattb8 merged 4 commits intomainfrom
SDK-50-pixel-package-scaffold

Conversation

@bkbooth
Copy link
Copy Markdown
Contributor

@bkbooth bkbooth commented Apr 7, 2026

Summary

Scaffolds the @imtbl/pixel package and ships three self-contained modules with zero dependency on PR #2824:

  • Attribution (attribution.ts): Parses UTM params, ad click IDs (gclid/fbclid/ttclid/msclkid), referrer, and landing page — session-cached in sessionStorage
  • Loader (loader.ts): GA-style command-queue pattern (window.__imtbl) with pre-load command replay
  • Snippet (snippet.ts): Generates the embeddable <script> tag for studio integration

Package builds to a single IIFE bundle (dist/imtbl.js) — 1.52 KB raw / 823 bytes gzipped, well under the 10 KB budget.

20 tests passing across 3 suites. Lint and typecheck clean.

What's next (after PR #2824 merges)

  • Consent state machine (needs ConsentLevel/ConsentStatus types, queue.purge())
  • Core pixel class (needs storagePrefix, collectContext(lib, ver), flushUnload())
  • Session cookie (needs exported cookie helpers with domain param)

Resolves: SDK-50

Test plan

  • pnpm --filter @imtbl/pixel test — 20/20 passing
  • pnpm --filter @imtbl/pixel build — IIFE bundle produced
  • pnpm --filter @imtbl/pixel lint — clean
  • pnpm --filter @imtbl/pixel typecheck — clean
  • CI passes

🤖 Generated with Claude Code

…r, and snippet

Add the pixel package scaffold and three self-contained modules that have
no dependency on PR #2824. The package builds to a single IIFE bundle
(dist/imtbl.js) targeting <10KB gzipped (currently 823 bytes).

Modules:
- attribution: UTM params, ad click IDs, referrer, landing page (session-cached)
- loader: command-queue pattern (window.__imtbl) with pre-load replay
- snippet: embeddable <script> tag generator for studio integration

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@bkbooth bkbooth requested review from a team as code owners April 7, 2026 03:14
@nx-cloud
Copy link
Copy Markdown

nx-cloud bot commented Apr 7, 2026

View your CI Pipeline Execution ↗ for commit cfab2ca

Command Status Duration Result
nx affected -t build,lint,test ✅ Succeeded 2m 25s View ↗
nx run-many -p @imtbl/sdk,@imtbl/checkout-widge... ✅ Succeeded 1m 4s View ↗

☁️ Nx Cloud last updated this comment at 2026-04-07 07:37:36 UTC

Comment thread packages/audience/pixel/src/attribution.ts
… reference

Add dclid (Google DV360) and li_fat_id (LinkedIn) to match the
Tracking Pixel Event Reference doc. Also add referral_code parsing
and touchpoint_type derivation (set to 'click' when UTMs or click
IDs are present).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@bkbooth
Copy link
Copy Markdown
Contributor Author

bkbooth commented Apr 7, 2026

Good catch @nattb8 — no reason to leave them out. Added dclid (Google DV360) and li_fat_id (LinkedIn) in 09736d7.

Also added referral_code parsing and touchpoint_type derivation ("click" when UTMs or click IDs are present) to match the Event Reference doc. 4 new tests covering these fields.

@nattb8 nattb8 added this pull request to the merge queue Apr 7, 2026
Merged via the queue into main with commit 3cdf46d Apr 7, 2026
7 checks passed
@nattb8 nattb8 deleted the SDK-50-pixel-package-scaffold branch April 7, 2026 08:57
bkbooth added a commit that referenced this pull request Apr 7, 2026
…sent

Resolve conflicts: keep HEAD versions for pixel package config,
re-delete attribution files that were reintroduced from main (#2829),
add packages/audience/sdk from main to pnpm-workspace.yaml.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

3 participants