Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions src/track.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { ComponentSettings, MCEvent } from '@managed-components/types'

// sourced from https://ads.tiktok.com/help/article/about-parameters?lang=en
const USER_DATA: Record<string, { hashed?: boolean }> = {
email: { hashed: true },
phone: { hashed: true },
Expand All @@ -8,6 +9,19 @@
ttp: { hashed: false },
ttclid: { hashed: false },
locale: { hashed: false },
content_type: { hashed: false },
quantity: { hashed: false },
description: { hashed: false },
content_ids: { hashed: false },
currency: { hashed: false },
price: { hashed: false },
value: { hashed: false },
search_string: { hashed: false },
contents: { hashed: false },
delivery_category: { hashed: false },
content_name: { hashed: false },
content_category: { hashed: false },
status: { hashed: false },
}

const getTtclid = (event: MCEvent) => {
Expand All @@ -30,7 +44,7 @@
const eventId =
payload.event_id || String(Math.round(Math.random() * 100000000000000000))

const body: { [k: string]: any } = {

Check warning on line 47 in src/track.ts

View workflow job for this annotation

GitHub Actions / build-test (20.x)

Unexpected any. Specify a different type
event:
(eventType === 'pageview' ? 'ViewContent' : payload.ev) ||
payload.cev ||
Expand Down
Loading