Skip to content

Commit 3fb1b7b

Browse files
densumeshcdxker
authored andcommitted
feature: use checkout end events for purchase
1 parent 40f06f7 commit 3fb1b7b

File tree

11 files changed

+60
-33
lines changed

11 files changed

+60
-33
lines changed

clients/trieve-shopify-extension/app/components/analytics/EventPathSelector.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,23 +13,23 @@ export const chatEvents: KnownEventNames[] = [
1313
"component_open",
1414
"conversation_started",
1515
"site-add_to_cart",
16-
"site-checkout",
16+
"site-checkout_end",
1717
];
1818

1919
export const searchEvents: KnownEventNames[] = [
2020
"component_load",
2121
"component_open",
2222
"searched",
2323
"site-add_to_cart",
24-
"site-checkout",
24+
"site-checkout_end",
2525
];
2626

2727
export const recommendationEvents: KnownEventNames[] = [
2828
"component_load",
2929
"component_open",
3030
"recommendation_created",
3131
"site-add_to_cart",
32-
"site-checkout",
32+
"site-checkout_end",
3333
];
3434

3535
export const EventPathSelector = (props: EventPathSelectorProps) => {

clients/trieve-shopify-extension/app/components/analytics/chat/ChatEventsFilter.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ export const AVAILABLE_EVENT_TYPES: { label: string; value: EventNamesFilter }[]
1111
{ label: "Followup Clicked", value: "site-followup_query" },
1212
{ label: "Click", value: "Click" },
1313
{ label: "Add to Cart", value: "site-add_to_cart" },
14-
{ label: "Checkout", value: "site-checkout" },
14+
{ label: "Checkout", value: "site-checkout_end" },
1515
];
1616

1717
const eventTypeSelectOptions = [

clients/trieve-shopify-extension/app/routes/app._dashboard.chats.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ export default function ChatsPage() {
7878
data?.topics.map((topic) => {
7979
let event_names_counts: Record<string, number> = {
8080
"site-add_to_cart": 0,
81-
"site-checkout": 0,
81+
"site-checkout_end": 0,
8282
"Click": 0,
8383
};
8484
for (const event of topic.event_names) {

clients/trieve-shopify-extension/app/utils/formatting.ts

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -193,9 +193,9 @@ export const fillDate = <T>({
193193
return foundDataPoint
194194
? foundDataPoint
195195
: {
196-
time: d,
197-
value: defaultValue,
198-
};
196+
time: d,
197+
value: defaultValue,
198+
};
199199
});
200200
} else if (granularity == "hour") {
201201
info = eachHourOfInterval({
@@ -220,9 +220,9 @@ export const fillDate = <T>({
220220
return foundDataPoint
221221
? foundDataPoint
222222
: {
223-
time: d,
224-
value: defaultValue,
225-
};
223+
time: d,
224+
value: defaultValue,
225+
};
226226
});
227227
} else if (granularity == "minute") {
228228
info = eachMinuteOfInterval({
@@ -247,9 +247,9 @@ export const fillDate = <T>({
247247
return foundDataPoint
248248
? foundDataPoint
249249
: {
250-
time: d,
251-
value: defaultValue,
252-
};
250+
time: d,
251+
value: defaultValue,
252+
};
253253
});
254254
}
255255

@@ -278,7 +278,7 @@ export const formatTimeValueForChart = (
278278
export type KnownEventNames =
279279
| "component_load"
280280
| "site-add_to_cart"
281-
| "site-checkout"
281+
| "site-checkout_end"
282282
| "Click"
283283
| "View"
284284
| "searched"
@@ -295,7 +295,7 @@ export const formatEventName = (
295295
return "Load Modal";
296296
} else if (event === "site-add_to_cart") {
297297
return "Add to Cart";
298-
} else if (event === "site-checkout") {
298+
} else if (event === "site-checkout_end") {
299299
return "Checkout";
300300
} else if (event === "component_open") {
301301
return "Open Modal";

clients/trieve-shopify-extension/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@
5555
"tailwind-merge": "^3.1.0",
5656
"tailwindcss": "^3.4.17",
5757
"trieve-search-component": "0.4.55",
58-
"trieve-ts-sdk": "0.0.86",
58+
"trieve-ts-sdk": "^0.0.89",
5959
"vite-tsconfig-paths": "^5.0.1"
6060
},
6161
"devDependencies": {

clients/trieve-shopify-extension/yarn.lock

Lines changed: 32 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8979,7 +8979,16 @@ string-hash@^1.1.3:
89798979
resolved "https://registry.yarnpkg.com/string-hash/-/string-hash-1.1.3.tgz#e8aafc0ac1855b4666929ed7dd1275df5d6c811b"
89808980
integrity sha512-kJUvRUFK49aub+a7T1nNE66EJbZBMnBgoC1UbCZ5n6bsZKBRga4KgBRTMn/pFkeCZSYtNeSyMxPDM0AXWELk2A==
89818981

8982-
"string-width-cjs@npm:string-width@^4.2.0", string-width@^4.1.0, string-width@^4.2.0, string-width@^4.2.3:
8982+
"string-width-cjs@npm:string-width@^4.2.0":
8983+
version "4.2.3"
8984+
resolved "https://registry.yarnpkg.com/string-width/-/string-width-4.2.3.tgz#269c7117d27b05ad2e536830a8ec895ef9c6d010"
8985+
integrity sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==
8986+
dependencies:
8987+
emoji-regex "^8.0.0"
8988+
is-fullwidth-code-point "^3.0.0"
8989+
strip-ansi "^6.0.1"
8990+
8991+
string-width@^4.1.0, string-width@^4.2.0, string-width@^4.2.3:
89838992
version "4.2.3"
89848993
resolved "https://registry.yarnpkg.com/string-width/-/string-width-4.2.3.tgz#269c7117d27b05ad2e536830a8ec895ef9c6d010"
89858994
integrity sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==
@@ -9087,7 +9096,14 @@ stringify-entities@^4.0.0:
90879096
character-entities-html4 "^2.0.0"
90889097
character-entities-legacy "^3.0.0"
90899098

9090-
"strip-ansi-cjs@npm:strip-ansi@^6.0.1", strip-ansi@^6.0.0, strip-ansi@^6.0.1:
9099+
"strip-ansi-cjs@npm:strip-ansi@^6.0.1":
9100+
version "6.0.1"
9101+
resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-6.0.1.tgz#9e26c63d30f53443e9489495b2105d37b67a85d9"
9102+
integrity sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==
9103+
dependencies:
9104+
ansi-regex "^5.0.1"
9105+
9106+
strip-ansi@^6.0.0, strip-ansi@^6.0.1:
90919107
version "6.0.1"
90929108
resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-6.0.1.tgz#9e26c63d30f53443e9489495b2105d37b67a85d9"
90939109
integrity sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==
@@ -9356,10 +9372,10 @@ trieve-ts-sdk@0.0.73:
93569372
resolved "https://registry.yarnpkg.com/trieve-ts-sdk/-/trieve-ts-sdk-0.0.73.tgz#9de17428ddb4b1f6d68709695f371d185c4bda79"
93579373
integrity sha512-68iG/OlmKSGmnmI/J33S6VKleEAfq4txzARhvKv1g+CYSaG7HOH76n0cFDMtUUEEKn1PD4nV82uh5ZFtfIxD0A==
93589374

9359-
trieve-ts-sdk@0.0.86:
9360-
version "0.0.86"
9361-
resolved "https://registry.yarnpkg.com/trieve-ts-sdk/-/trieve-ts-sdk-0.0.86.tgz#c9600cc426caff7ad5c2f929fe513cc55ebece40"
9362-
integrity sha512-f9W9dNT6hdAVPlbX+/LvYtRZdKreiWrG6w7yOIfZQsKxa9BKBtc3harJMisKT5cXp0NlgHW2RwSgq3mb1fQffQ==
9375+
trieve-ts-sdk@^0.0.89:
9376+
version "0.0.89"
9377+
resolved "https://registry.yarnpkg.com/trieve-ts-sdk/-/trieve-ts-sdk-0.0.89.tgz#d3128840b2e1fdadbc2a860e0ca53654d1da4d69"
9378+
integrity sha512-32GRoIbzEJCmHsqp3hWkpuaB16lpnQISXLMWLjfEGI6q5qUyGWsEGRJXkZsQokTSZuLlsDKcKu0IKWjXkdfWYQ==
93639379

93649380
trim-lines@^3.0.0:
93659381
version "3.0.1"
@@ -10019,7 +10035,7 @@ word-wrap@^1.2.5:
1001910035
resolved "https://registry.yarnpkg.com/word-wrap/-/word-wrap-1.2.5.tgz#d2c45c6dd4fbce621a66f136cbe328afd0410b34"
1002010036
integrity sha512-BN22B5eaMMI9UMtjrGd5g5eCYPpCPDUy0FJXbYsaT5zYxjFOckS53SQDE3pWkVoWpHXVb3BrYcEN4Twa55B5cA==
1002110037

10022-
"wrap-ansi-cjs@npm:wrap-ansi@^7.0.0", wrap-ansi@^7.0.0:
10038+
"wrap-ansi-cjs@npm:wrap-ansi@^7.0.0":
1002310039
version "7.0.0"
1002410040
resolved "https://registry.yarnpkg.com/wrap-ansi/-/wrap-ansi-7.0.0.tgz#67e145cff510a6a6984bdf1152911d69d2eb9e43"
1002510041
integrity sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==
@@ -10037,6 +10053,15 @@ wrap-ansi@^6.0.1, wrap-ansi@^6.2.0:
1003710053
string-width "^4.1.0"
1003810054
strip-ansi "^6.0.0"
1003910055

10056+
wrap-ansi@^7.0.0:
10057+
version "7.0.0"
10058+
resolved "https://registry.yarnpkg.com/wrap-ansi/-/wrap-ansi-7.0.0.tgz#67e145cff510a6a6984bdf1152911d69d2eb9e43"
10059+
integrity sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==
10060+
dependencies:
10061+
ansi-styles "^4.0.0"
10062+
string-width "^4.1.0"
10063+
strip-ansi "^6.0.0"
10064+
1004010065
wrap-ansi@^8.1.0:
1004110066
version "8.1.0"
1004210067
resolved "https://registry.yarnpkg.com/wrap-ansi/-/wrap-ansi-8.1.0.tgz#56dc22368ee570face1b49819975d9b9a5ead214"

clients/ts-sdk/openapi.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11686,7 +11686,7 @@
1168611686
"site-followup_query",
1168711687
"Click",
1168811688
"site-add_to_cart",
11689-
"site-checkout"
11689+
"site-checkout_end"
1169011690
]
1169111691
},
1169211692
"EventReturn": {

clients/ts-sdk/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
"files": [
1818
"dist"
1919
],
20-
"version": "0.0.87",
20+
"version": "0.0.89",
2121
"license": "MIT",
2222
"scripts": {
2323
"lint": "eslint 'src/**/*.ts'",

clients/ts-sdk/src/types.gen.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1540,7 +1540,7 @@ export type EventNameAndCountsResponse = {
15401540
event_names: Array<EventNameAndCounts>;
15411541
};
15421542

1543-
export type EventNamesFilter = 'component_close' | 'component_open' | 'View' | 'site-followup_query' | 'Click' | 'site-add_to_cart' | 'site-checkout';
1543+
export type EventNamesFilter = 'component_close' | 'component_open' | 'View' | 'site-followup_query' | 'Click' | 'site-add_to_cart' | 'site-checkout_end';
15441544

15451545
export type EventReturn = {
15461546
event_types: Array<(string)>;

server/src/data/models.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7332,8 +7332,8 @@ pub enum EventNamesFilter {
73327332
#[display(rename = "site-add_to_cart", fmt = "site-add_to_cart")]
73337333
#[serde(rename = "site-add_to_cart")]
73347334
AddToCart,
7335-
#[display(rename = "site-checkout", fmt = "site-checkout")]
7336-
#[serde(rename = "site-checkout")]
7335+
#[display(rename = "site-checkout_end", fmt = "site-checkout_end")]
7336+
#[serde(rename = "site-checkout_end")]
73377337
Checkout,
73387338
}
73397339

@@ -7346,7 +7346,7 @@ impl EventNamesFilter {
73467346
"site-followup_query" => EventNamesFilter::FollowupQuery,
73477347
"Click" => EventNamesFilter::Click,
73487348
"site-add_to_cart" => EventNamesFilter::AddToCart,
7349-
"site-checkout" => EventNamesFilter::Checkout,
7349+
"site-checkout_end" => EventNamesFilter::Checkout,
73507350
_ => EventNamesFilter::View,
73517351
}
73527352
}
@@ -7359,7 +7359,7 @@ impl EventNamesFilter {
73597359
EventNamesFilter::FollowupQuery => String::from("site-followup_query"),
73607360
EventNamesFilter::Click => String::from("Click"),
73617361
EventNamesFilter::AddToCart => String::from("site-add_to_cart"),
7362-
EventNamesFilter::Checkout => String::from("site-checkout"),
7362+
EventNamesFilter::Checkout => String::from("site-checkout_end"),
73637363
}
73647364
}
73657365
}

0 commit comments

Comments
 (0)