Skip to content

Commit 10e02a3

Browse files
feat: add pathname to tracked anonymouns events for context (#516)
Signed-off-by: David Dal Busco <david.dalbusco@outlook.com>
1 parent 5627000 commit 10e02a3

1 file changed

Lines changed: 7 additions & 1 deletion

File tree

src/components/AskAi/index.tsx

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import IconMarkdown from "@site/static/icons/markdown.svg";
66
import IconOpenAI from "@site/static/icons/openai.svg";
77
import styles from "./styles.module.scss";
88

9-
const AskAiLink = ({ icon, text, link, description, eventName }) => {
9+
const AskAiLink = ({ icon, text, link, description, pathname, eventName }) => {
1010
const { siteConfig } = useDocusaurusContext();
1111

1212
return (
@@ -19,6 +19,9 @@ const AskAiLink = ({ icon, text, link, description, eventName }) => {
1919
onClick={() =>
2020
trackEvent({
2121
name: eventName,
22+
metadata: {
23+
pathname
24+
},
2225
siteConfig
2326
})
2427
}
@@ -69,6 +72,7 @@ export const AskAi = () => {
6972
<AskAiLink
7073
icon={<IconMarkdown />}
7174
link={markdownLink}
75+
pathname={pathname}
7276
text="View as Markdown"
7377
description="Open this page in Markdown"
7478
eventName="ask_ai_view_markdown"
@@ -77,6 +81,7 @@ export const AskAi = () => {
7781
<AskAiLink
7882
icon={<IconClaude />}
7983
link={claudeLink}
84+
pathname={pathname}
8085
text="Open in Claude"
8186
description="Ask questions about this page"
8287
eventName="ask_ai_claude"
@@ -85,6 +90,7 @@ export const AskAi = () => {
8590
<AskAiLink
8691
icon={<IconOpenAI />}
8792
link={chatGPTLink}
93+
pathname={pathname}
8894
text="Open in ChatGPT"
8995
description="Ask questions about this page"
9096
eventName="ask_ai_chatgpt"

0 commit comments

Comments
 (0)