fix(tiktokPixel): missing types#773
Conversation
…andard events
Adds optional fourth `options` arg to `ttq('track', ...)` typed overload
exposing `event_id` for Pixel + Events API deduplication, and adds the
current TikTok standard events `Purchase` and `StartTrial` to the
`StandardEvents` union.
Closes #767
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
commit: |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthroughThis PR extends the TikTok Pixel registry type definitions. It adds Estimated code review effort🎯 2 (Simple) | ⏱️ ~8 minutes 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
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. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@packages/script/src/runtime/registry/tiktok-pixel.ts`:
- Line 16: The StandardEvents union in tiktok-pixel.ts includes an invalid
member 'StartTrial' that is not part of TikTok's official Pixel standard events;
remove 'StartTrial' from the StandardEvents type (and any occurrences where it
is used/mapped) so the union only contains documented events like ViewContent,
AddToCart, InitiateCheckout, Purchase, etc.; update related enums or mappings
that reference 'StartTrial' (search for StandardEvents and any mapping
functions/classes in this file) to avoid dangling references.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 7061713d-eff9-4a70-920f-3a7d778c948b
📒 Files selected for processing (1)
packages/script/src/runtime/registry/tiktok-pixel.ts
| | 'AddPaymentInfo' | ||
| | 'CompletePayment' | ||
| | 'PlaceAnOrder' | ||
| | 'Purchase' |
There was a problem hiding this comment.
🧩 Analysis chain
🌐 Web query:
TikTok Pixel standard events list 2024 2025
💡 Result:
TikTok Pixel standard events list (the set of predefined web standard events you can send via TikTok Pixel / Events API) is not broken out by year (2024 vs 2025). The authoritative source is TikTok’s “Standard Events and Parameters” page, which lists the standard event names TikTok supports and is updated over time. As of TikTok’s latest help content, the supported standard event names include: ViewContent, AddToCart, AddToWishlist, InitiateCheckout, AddPaymentInfo, CompletePayment, Purchase (alias/mapped to CompletePayment in reserved-event mapping), PlaceAnOrder, Subscribe, Download, Search, Contact, SubmitForm, CompleteRegistration, and ApplicationApproval. [1][2][3] Note: There is also a separate “reserved events” list that maps certain reserved event names to standard events (e.g., AddBilling → AddPaymentInfo; Checkout → PlaceAnOrder/InitiateCheckout mappings; Registration → CompleteRegistration; Browse → ViewContent; etc.). You should not use reserved event names as custom events because TikTok automatically maps them to standard events. [3] Sources: TikTok Ads Manager help, “Standard Events and Parameters” and “About reserved events” pages. [1][3]
Citations:
- 1: https://ads.tiktok.com/help/article/standard-events-parameters?__hstc=188508983.20e3acfa39ad61fc2bb972fba4bdef19.1748908800443.1748908800444.1748908800445.1&__hssc=188508983.1.1748908800446&__hsfp=3282704936&redirected=1
- 2: https://ads.tiktok.com/help/article/standard-events-parameters?lang=en
- 3: https://ads.tiktok.com/help/article/reserved-events?lang=en
Remove 'StartTrial' from StandardEvents union—it is not in TikTok's official standard events list.
TikTok's official documentation lists these standard events: ViewContent, AddToCart, AddToWishlist, InitiateCheckout, AddPaymentInfo, CompletePayment, Purchase, PlaceAnOrder, Subscribe, Download, Search, Contact, SubmitForm, CompleteRegistration, and ApplicationApproval. 'Purchase' is confirmed valid, but 'StartTrial' does not appear in the official Pixel API documentation and should not be included as a standard event unless it is explicitly mapped or documented by TikTok's API contract.
Also applies to: 22-22
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@packages/script/src/runtime/registry/tiktok-pixel.ts` at line 16, The
StandardEvents union in tiktok-pixel.ts includes an invalid member 'StartTrial'
that is not part of TikTok's official Pixel standard events; remove 'StartTrial'
from the StandardEvents type (and any occurrences where it is used/mapped) so
the union only contains documented events like ViewContent, AddToCart,
InitiateCheckout, Purchase, etc.; update related enums or mappings that
reference 'StartTrial' (search for StandardEvents and any mapping
functions/classes in this file) to avoid dangling references.
🔗 Linked issue
Resolves #767
❓ Type of change
📚 Description
The typed
ttq('track', ...)overload didn't expose TikTok's optional 4thoptionsarg, so users couldn't passevent_idfor Pixel + Events API deduplication without casting. TheStandardEventsunion was also missingPurchaseandStartTrial.Adds the 4th
optionsarg withevent_idto thetrackoverload and extendsStandardEvents, preserving the(string & {})escape hatch for custom event names.✅ Verification
pnpm test:types— TikTok-related type tests pass (pre-existing posthog version-mismatch errors are unrelated).