Skip to content

Commit 5702ba1

Browse files
authored
Add Microsoft Clarity code to all pages (#153)
* Add `@microsoft/clarity` code * Create `Root.js` * Add `@microsoft/clarity` code
1 parent 76f6b44 commit 5702ba1

File tree

2 files changed

+30
-0
lines changed

2 files changed

+30
-0
lines changed

src/theme/DocsRoot/index.tsx

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
import React from 'react';
2+
import clsx from 'clsx';
3+
import {ThemeClassNames, HtmlClassNameProvider} from '@docusaurus/theme-common';
4+
import renderRoutes from '@docusaurus/renderRoutes';
5+
import Layout from '@theme/Layout';
6+
import Clarity from '@microsoft/clarity';
7+
8+
import type {Props} from '@theme/DocVersionRoot';
9+
10+
const projectId = "p9179dcazx"
11+
12+
Clarity.init(projectId);
13+
14+
export default function DocsRoot(props: Props): JSX.Element {
15+
return (
16+
<HtmlClassNameProvider className={clsx(ThemeClassNames.wrapper.docsPages)}>
17+
<Layout>{renderRoutes(props.route.routes!)}</Layout>
18+
</HtmlClassNameProvider>
19+
);
20+
}

src/theme/Root.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
import React from 'react';
2+
import Clarity from '@microsoft/clarity';
3+
4+
const projectId = "p9179dcazx"
5+
Clarity.init(projectId);
6+
7+
// Default implementation, that you can customize
8+
export default function Root({children}) {
9+
return <>{children}</>;
10+
}

0 commit comments

Comments
 (0)