Skip to content

feat(tiktokPixel): production hardening - region, CAPI dedup, advanced matching#776

Merged
harlan-zw merged 4 commits into
mainfrom
feat/tiktok-pixel-production-hardening
May 14, 2026
Merged

feat(tiktokPixel): production hardening - region, CAPI dedup, advanced matching#776
harlan-zw merged 4 commits into
mainfrom
feat/tiktok-pixel-production-hardening

Conversation

@harlan-zw
Copy link
Copy Markdown
Collaborator

🔗 Linked issue

Follow-up to #773.

❓ Type of change

  • 📖 Documentation
  • 🐞 Bug fix
  • 👌 Enhancement
  • ✨ New feature
  • 🧹 Chore
  • ⚠️ Breaking change

📚 Description

Builds on the typed event_id/standard-events surface added in #773 to make the registry entry production-ready for enterprise setups.

  • region: 'us' | 'global' — routes the Pixel SDK through analytics.us.tiktok.com (default analytics.tiktok.com) for US data residency. Bundle resolver and proxy domain allowlist both updated.
  • TrackOptions.test_event_code — TikTok's Test Events sandbox identifier so QA traffic doesn't pollute production reporting.
  • EventProperties.order_id — transaction-level dedup, complementing the event-level event_id.
  • Expanded IdentifyProperties — adds first_name, last_name, city, state, country, zip_code (advanced matching fields beyond email/phone/external_id).
  • Dev-mode unhashed-PII warning — TikTok silently drops unhashed advanced-matching values. identify() now logs a console warning in dev when a SHA-256 hex check fails for any matching field. Tree-shaken in production via import.meta.dev.
  • Docs — new sections for data residency, server-side CAPI deduplication (with full Pixel + Events-API example), test events, and advanced matching (with ohash SHA-256 example).

✅ Verification

  • pnpm test:types — 38/38 pass (12 pre-existing posthog version-mismatch errors unrelated to this PR).
  • Manual: enterprise consumer sets region: 'us' -> SDK loads from analytics.us.tiktok.com.
  • Manual: dev-mode identify({ email: 'plain@x.com' }) -> console warning logged.

harlan-zw added 3 commits May 14, 2026 15:45
…d matching

- region: 'us' option routes SDK through analytics.us.tiktok.com for data residency
- TrackOptions: add test_event_code for Test Events sandbox
- EventProperties: add order_id (transaction-level dedup)
- IdentifyProperties: add first_name/last_name/city/state/country/zip_code
- dev warning when identify() receives unhashed values (SHA-256 required)
- docs: server-side dedup, region, test events, advanced matching sections
@vercel
Copy link
Copy Markdown
Contributor

vercel Bot commented May 14, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
scripts-playground Ready Ready Preview, Comment May 14, 2026 5:54am

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 14, 2026

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 3dbb5a60-715e-4c1a-9c46-cc0417393e05

📥 Commits

Reviewing files that changed from the base of the PR and between 2d66847 and a5e837d.

📒 Files selected for processing (1)
  • packages/script/src/registry.ts

📝 Walkthrough

Walkthrough

This PR extends the TikTok Pixel integration with region-aware routing and enhanced event tracking capabilities. It adds a region configuration option to support US data residency, updates the track and identify APIs with new event types and properties including order_id, test_event_code, and advanced-matching fields, introduces runtime validation for SHA-256-hashed identify fields, and updates the registry to dynamically generate region-specific bundle URLs.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 50.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately reflects the main changes: region support, CAPI dedup via event_id, and advanced matching for TikTok Pixel production readiness.
Description check ✅ Passed The description is directly related to the changeset, clearly explaining the purpose, features added, and verification performed for the TikTok Pixel production hardening.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/tiktok-pixel-production-hardening

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@pkg-pr-new
Copy link
Copy Markdown

pkg-pr-new Bot commented May 14, 2026

Open in StackBlitz

npm i https://pkg.pr.new/@nuxt/scripts@776

commit: a5e837d

@harlan-zw
Copy link
Copy Markdown
Collaborator Author

fyi @felixgabler

@harlan-zw harlan-zw merged commit c5b6905 into main May 14, 2026
19 checks passed
@harlan-zw harlan-zw deleted the feat/tiktok-pixel-production-hardening branch May 14, 2026 05:58
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.

1 participant