Created
March 27, 2023 21:04
-
-
Save elephantsneverforget/da66ae71e9211c307a7a6d9585bff120 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export type KlaviyoEventPayload = { | |
data: { | |
type: "event"; | |
attributes: { | |
time: string; // "2022-11-08T00:00:00" | |
value: number; | |
unique_id: string; // event_id | |
profile: { | |
// One of email or phone is required on every API call | |
$email: string; | |
$phone_number?: string; | |
$first_name?: string; | |
$last_name?: string; | |
$city?: string; | |
$region?: string; | |
$country?: string; | |
$zip?: string; | |
$image?: string; | |
$consent?: string; | |
}; | |
metric: { | |
name: KlaviyoDLEventName; | |
}; | |
properties: { | |
// Where event data goes. Top level items are segmentable in platform so data needs to show twice here | |
// See bottom of https://help.klaviyo.com/hc/en-us/articles/115005062847 | |
itemNames: Array<string>; | |
productIds: Array<string>; | |
variantIds: Array<string>; | |
prices: Array<number>; | |
// skus: Array<string>; // not sending sku since not all products have this and could throw off segments if some have and some don't | |
categories?: Array<string>; | |
imageURLs?: Array<string>; | |
brands?: Array<string>; | |
compareAtPrices?: Array<number>; | |
items?: Array<KlaviyoItem>; | |
}; | |
}; | |
}; | |
}; | |
type KlaviyoItem = { | |
name: string; | |
productId: string; | |
variantId: string; | |
price: number; | |
sku?: string; // not sending sku because not all products have this and could affect reporting | |
quantity?: number; | |
imageURL?: string; | |
category?: string; | |
brand?: string; | |
productURL?: string; | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment