Skip to content

Commit

Permalink
feat: GROW-284 - Add location
Browse files Browse the repository at this point in the history
  • Loading branch information
hba-fingerprint committed Nov 18, 2024
1 parent 498b0ae commit 157b6e7
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
7 changes: 7 additions & 0 deletions src/client/thirdParty/Amplitude.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { usePlaygroundSignals } from '../../app/playground/hooks/usePlaygroundSi
import { FunctionComponent } from 'react';
import { useVisitorData } from '@fingerprintjs/fingerprintjs-pro-react';
import { FPJS_CLIENT_TIMEOUT } from '../../const';
import { useLocation } from 'react-use';

const AMPLITUDE_INGRESS_PROXY = 'https://demo.fingerprint.com/ampl-api/2/httpapi';
const EVENT_TYPE = 'Demo Page Viewed';
Expand Down Expand Up @@ -57,11 +58,17 @@ function initPlaygroundSignals() {
const visitorId = event.products.identification?.data?.visitorId;
const botDetected = event?.products?.botd?.data?.bot?.result === 'bad' ? 'True' : 'False';

const location = useLocation();
const pagePath = location.pathname;
const pageTitle = document.title;

amplitude.add(demoPageViewedEventPropertiesEnrichment(botDetected));

amplitude.track(EVENT_TYPE, {
botDetected,
visitorId,
'Docs Page Path': pagePath,
'Docs Page Title': pageTitle,
});
},
});
Expand Down
2 changes: 1 addition & 1 deletion src/client/thirdParty/Inkeep.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import type {
} from '@inkeep/uikit';
import { env } from '../../env';
import dynamic from 'next/dynamic';
import { trackAskAIkHelpMethodChosen } from "./Amplitude";
import { trackAskAIkHelpMethodChosen } from './Amplitude';

const GET_HELP_OPTIONS_CLICKED = 'get_help_option_clicked';

Expand Down

0 comments on commit 157b6e7

Please sign in to comment.