Types
Params Argument
params argument that you get in process function is an object that has the following structure:
request
handleTag
(payload: CDNTagPayload, user?: { userId?: string; dbId?: number }) => void
getUsersByEmail
(email: string) => Promise<{ userId: string; dbId: number }[] | null>
getUsersByCustomData
(key: string, value: string) => Promise<{ userId: string; dbId: number }[] | null>
getUserByUserId
(userId: string) => Promise<{ dbId: string; user: FullUser, customData: Record<string, string> } | null>
saveUserCustomData
(userId: string, key: string, value: string, dbId?: number) ⇒ Promise<boolean>
writeError
(category: ErrorCategory, error: Error)=> void
logger
{ log: (...args: unknown[]) => void, error: (...args: unknown[]) => void }
secrets
Record<string,string>
ErrorCategory
authorization | payload | setup | infrastructure | worker | other | no-action | audience | unknown
CDNTagPayload
eventName
Event name
string
Yes
eventId
Event ID that needs to be unique
string
Yes
timestamp
Timestamp of the event
number
Yes
data
Data that is sent with the event
Record<string, unknown}
No
storage
Storage can be used to pass consent data, see Shopify template
Record<string, unknown>
No
providers
Providers that are allowed to receive this event. Example: { all: false, facebook: true }
Partial<{ all: boolean } & Record<string, Partial<({ all: boolean } & Record<string, boolean>) | boolean>>>
No
pageUrl
URL of the page where the event happened
string
No
pageTitle
Title of the page where the event happened
string
No
userAgent
User agent of the browser
string
No
You can also add user information to CDNTagPayload, which is defined in this list. The only change is that you need to prefix it with user.
For example: userEmail, userFirstName
FullUser
User's email address
string
Yes
phone
User's phone number
string
No
firstName
User's first name
string
No
lastName
User's last name
string
No
gender
User's gender
string
No
dateOfBirth
User's date of birth
string
No
country
User's country
string
No
state
User's state
string
No
city
User's city
string
No
zip
User's zip code
string
No
ip
User's IP address
string
No
consent
User's consent string
string
No
consentCategories
User's consent categories
string
No
created_at
User creation timestamp
string
No
user_id
User's unique ID
string
Yes
Last updated
Was this helpful?

