Skip to content

Commit 2be159a

Browse files
committed
feat: add clarity to monitor user-behavior
1 parent fd8656c commit 2be159a

File tree

4 files changed

+20
-0
lines changed

4 files changed

+20
-0
lines changed

package.json

+1
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
"@iconify-json/fa6-solid": "^1.2.2",
3131
"@iconify-json/material-symbols": "^1.2.8",
3232
"@iconify/svelte": "^4.0.2",
33+
"@microsoft/clarity": "^1.0.0",
3334
"@swup/astro": "^1.5.0",
3435
"@tailwindcss/typography": "^0.5.15",
3536
"astro": "5.1.6",

pnpm-lock.yaml

+8
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/layouts/Layout.astro

+7
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,13 @@ const bannerOffset =
137137
offset = offset - offset % 4;
138138
document.documentElement.style.setProperty('--banner-height-extend', `${offset}px`);
139139
</script>
140+
<script type="text/javascript">
141+
(function(c,l,a,r,i,t,y){
142+
c[a]=c[a]||function(){(c[a].q=c[a].q||[]).push(arguments)};
143+
t=l.createElement(r);t.async=1;t.src="https://www.clarity.ms/tag/"+i;
144+
y=l.getElementsByTagName(r)[0];y.parentNode.insertBefore(t,y);
145+
})(window, document, "clarity", "script", "r884fqcpf2");
146+
</script>
140147
<style define:vars={{
141148
configHue,
142149
'page-width': `${PAGE_WIDTH}rem`,

src/pages/[...page].astro

+4
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,10 @@ import { PAGE_SIZE } from '../constants/constants'
66
import MainGridLayout from '../layouts/MainGridLayout.astro'
77
import { getSortedPosts } from '../utils/content-utils'
88
9+
// import Clarity from '@microsoft/clarity';
10+
// const projectId = "r884fqcpf2"
11+
// Clarity.init(projectId);
12+
913
export const getStaticPaths = (async ({ paginate }) => {
1014
const allBlogPosts = await getSortedPosts()
1115
return paginate(allBlogPosts, { pageSize: PAGE_SIZE })

0 commit comments

Comments
 (0)