Skip to content
Merged
Show file tree
Hide file tree
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
2 changes: 1 addition & 1 deletion docs/content/scripts/tiktok-pixel.md
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ proxy.ttq('track', 'Purchase', { value: 99 }, { test_event_code: 'TEST12345' })

## Advanced Matching

TikTok requires identify fields (`email`, `phone_number`, `external_id`, `first_name`, `last_name`, `city`, `state`, `country`, `zip_code`) to be SHA-256-hashed lowercase. Raw values are silently ignored by TikTok; in development, Nuxt Scripts logs a warning when an unhashed value is detected:
TikTok requires identify fields (`email`, `phone_number`, `external_id`, `first_name`, `last_name`, `city`, `state`, `country`, `zip_code`) to be SHA-256-hashed lowercase. TikTok silently drops raw values; in development, Nuxt Scripts logs a warning if it spots an unhashed value:

```ts
import { sha256 } from 'ohash'
Expand Down
3 changes: 2 additions & 1 deletion packages/script/src/runtime/registry/tiktok-pixel.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import type { RegistryScriptInput, UseScriptContext } from '#nuxt-scripts/types'
import { withQuery } from 'ufo'
import { logger } from '../logger'
import { useRegistryScript } from '../utils'
import { TikTokPixelOptions } from './schemas'

Expand Down Expand Up @@ -115,7 +116,7 @@ function warnUnhashedIdentify(props: Record<string, unknown>): void {
return typeof v === 'string' && v.length > 0 && !SHA256_HEX.test(v)
})
if (offenders.length) {
console.warn(`[nuxt-scripts:tiktokPixel] identify() received unhashed value(s) for ${offenders.join(', ')}. TikTok requires SHA-256 hashing for advanced matching; raw values will be ignored. See https://business-api.tiktok.com/portal/docs?id=1739585702922241`)
logger.withTag('tiktokPixel').warn(`identify() received unhashed value(s) for ${offenders.join(', ')}. TikTok requires SHA-256 hashing for advanced matching; raw values will be ignored. See https://business-api.tiktok.com/portal/docs?id=1739585702922241`)
}
}

Expand Down
Loading