Skip to content

Commit cefa2fc

Browse files
committed
fix: Add missing CTA tracker for sidebar
1 parent 3ba8ee9 commit cefa2fc

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

apps/frontpage/app/event-log/route.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ function flatten(
1111
Object.entries(obj).forEach(([key, value]) => {
1212
let p: string = (prefix ? `${prefix}.${key}` : key)
1313
.replaceAll('@', '_at_')
14-
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access -- we know it's a string
14+
1515
.replaceAll('/', '_slash_');
1616

1717
if (p.startsWith('_')) {

apps/frontpage/components/docs/sidebar/docs-nav.tsx

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import { useEffect, useState, type FC } from 'react';
66
import { ChevronSmallRightIcon } from '@storybook/icons';
77
import type { TreeProps } from '@repo/utils';
88
import { cn, docsVersions } from '@repo/utils';
9+
import { usePlausible } from 'next-plausible';
910
import { usePathname, useSelectedLayoutSegment } from 'next/navigation';
1011
import { getVersion } from '../../../lib/get-version';
1112
import { VersionSelector } from './version-selector';
@@ -16,6 +17,8 @@ interface NavDocsProps {
1617
listOfTrees: TreeProps[];
1718
}
1819

20+
const GET_STARTED_SLUGS = ['/docs', '/docs/', '/docs/get-started', '/docs/get-started/'];
21+
1922
export const NavDocs: FC<NavDocsProps> = ({ listOfTrees }) => {
2023
const pathname = usePathname();
2124
const segment = useSelectedLayoutSegment();
@@ -66,6 +69,7 @@ export const NavDocs: FC<NavDocsProps> = ({ listOfTrees }) => {
6669

6770
const Level1 = ({ lvl1 }: { lvl1: TreeProps }) => {
6871
const pathname = usePathname();
72+
const plausible = usePlausible();
6973
let slug = lvl1.slug;
7074
docsVersions.forEach((version) => {
7175
if (
@@ -87,6 +91,9 @@ const Level1 = ({ lvl1 }: { lvl1: TreeProps }) => {
8791
isActive && 'text-blue-500',
8892
)}
8993
href={lvl1.slug}
94+
onClick={GET_STARTED_SLUGS.includes(lvl1.slug)
95+
? () => { plausible('GetStartedClick', { props: { location: 'sidebar-nav' }})}
96+
: undefined}
9097
>
9198
{lvl1.sidebar?.title ?? lvl1.title}
9299
</Link>

0 commit comments

Comments
 (0)