From 9a8ee0b8189f8e780ba55260a858b8f3b871dcbb Mon Sep 17 00:00:00 2001 From: Henrique Barreto Date: Thu, 28 Nov 2024 11:32:23 +0000 Subject: [PATCH] feat: GROW-284 - bring back eventName --- src/client/thirdParty/Inkeep.tsx | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/client/thirdParty/Inkeep.tsx b/src/client/thirdParty/Inkeep.tsx index bc2a699a..8c4ea637 100644 --- a/src/client/thirdParty/Inkeep.tsx +++ b/src/client/thirdParty/Inkeep.tsx @@ -12,6 +12,8 @@ import { trackAskAIHelpMethodChosen } from './Amplitude'; import { useVisitorData } from '@fingerprintjs/fingerprintjs-pro-react'; import { FPJS_CLIENT_TIMEOUT } from '../../const'; +const GET_HELP_OPTIONS_CLICKED = 'get_help_option_clicked'; + /** * Inkeep (AI Help) chat button * Implemented according to https://docs.inkeep.com/integrations/nextjs/chat-button @@ -37,11 +39,13 @@ const useInkeepSettings = (): InkeepSharedSettings => { const visitorId = data?.visitorId || ''; const logEventCallback = (event: any) => { - const { name } = event.properties; - const pagePath = document.location.pathname; - const pageTitle = document.title; + if (event.eventName === GET_HELP_OPTIONS_CLICKED) { + const { name } = event.properties; + const pagePath = document.location.pathname; + const pageTitle = document.title; - trackAskAIHelpMethodChosen(name, visitorId, pagePath, pageTitle); + trackAskAIHelpMethodChosen(name, visitorId, pagePath, pageTitle); + } }; const baseSettings: InkeepBaseSettings = {