Skip to content

Commit a2819e5

Browse files
committed
feat: umami integration
1 parent 47e3074 commit a2819e5

File tree

10 files changed

+124
-82
lines changed

10 files changed

+124
-82
lines changed

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
"@types/react-dom": "^18.3.5",
2929
"@unocss/preset-icons": "^65.4.3",
3030
"@unocss/transformer-variant-group": "^65.4.3",
31-
"astro": "^5.2.3",
31+
"astro": "^5.3.0",
3232
"autoprefixer": "^10.4.20",
3333
"clsx": "^2.1.1",
3434
"date-fns": "^3.6.0",
@@ -63,5 +63,5 @@
6363
"pnpm": "^10.1.0",
6464
"typescript": "^5.7.3"
6565
},
66-
"packageManager": "pnpm@9.14.2"
66+
"packageManager": "pnpm@10.0.0"
6767
}

pnpm-lock.yaml

Lines changed: 29 additions & 22 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/components/BaseHead.astro

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,24 @@ const { title, description, themeColor } = Astro.props;
1212
<meta name="viewport" content="width=device-width" />
1313
<meta name="description" content={description ?? "Xetera's Blog"} />
1414
<link rel="icon" type="image/png" href="/xetera_favicon.png" />
15+
<!--
16+
This is a tracking script for selfhosted, privacy-conscious https://umami.is analytics.
17+
Feel free to block it if you want but the data collected is stored locally on my cluster and not by a 3rd party.
18+
-->
19+
<script
20+
is:inline
21+
defer
22+
data-domains={Astro.site ? Astro.site.host : ""}
23+
src="https://overtime-contingency.xetera.dev/selfhosted-umami"
24+
data-website-id="fb997c11-6572-43df-bddf-9a64b1f2812d"></script>
25+
{
26+
// ignoring local visit + forks
27+
import.meta.env.DEV && (
28+
<script is:inline type="module">
29+
localStorage.setItem('umami.disabled', 1)
30+
</script>
31+
)
32+
}
1533
<!-- Repeating a little bit of code here to make sure this is inlined properly -->
1634
<script is:inline transition:persist>
1735
const modes = ["dark", "light", "system"];

src/components/Bio.astro

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ const latestShort = (await getAllShorts())[0];
4444
href={`https://github.com/${import.meta.env.SOCIAL_GITHUB}`}
4545
target="_blank"
4646
class="hover:color-text-900"
47+
data-umami-event="social:github"
4748
>
4849
<Github />
4950
</ExternalLink>
@@ -56,6 +57,7 @@ const latestShort = (await getAllShorts())[0];
5657
href={`https://twitter.com/${import.meta.env.SOCIAL_TWITTER}`}
5758
target="_blank"
5859
class="hover:color-text-900"
60+
data-umami-event="social:bsky"
5961
>
6062
<Twitter />
6163
</ExternalLink>
@@ -68,6 +70,7 @@ const latestShort = (await getAllShorts())[0];
6870
href=""
6971
target="_blank"
7072
class="email-target hover:color-text-900 relative"
73+
data-umami-event="social:email"
7174
>
7275
<div
7376
class="obfuscated-email hidden"

src/components/ExternalLink.astro

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,19 @@
11
---
2-
import type { AnchorHTMLAttributes } from "react";
2+
import type { HTMLAttributes } from "astro/types";
33
4-
interface Props extends AnchorHTMLAttributes<HTMLAnchorElement> {
4+
interface Props extends HTMLAttributes<"a"> {
55
href: string;
66
noIcon?: boolean;
77
class?: string;
8-
target?: AnchorHTMLAttributes<HTMLAnchorElement>["target"];
98
}
109
11-
const { href, noIcon, target, class: className } = Astro.props;
10+
const { href, noIcon, class: className, ...rest } = Astro.props;
1211
---
1312

1413
<a
1514
rel="noreferrer noopener"
15+
{...rest}
1616
href={href}
17-
href={target}
1817
class:list={[className, "external-link"]}
1918
>
2019
<slot />

src/components/kindle/BookGrid.astro

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,13 @@ const className = "book-item rounded";
5353
)}/dp/${book.asin}`;
5454
const render = <Book {...book} class={className} />;
5555
return (
56-
<a href={link} target="_blank">
56+
<a
57+
rel="noopener noreferrer"
58+
href={link}
59+
target="_blank"
60+
data-umami-event="book-timeline:poster-click"
61+
data-umami-event-book={book.title}
62+
>
5763
{render}
5864
</a>
5965
);

src/components/spotify/SpotifySidebar.astro

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,13 @@ const augmented = groupBy(
3737
<SpotifyDateDivider class="mb-3">{distance}</SpotifyDateDivider>
3838
<div class="flex flex-col gap-6">
3939
{songs.map((song) => (
40-
<a href={song.song.spotifyUrl} target="_blank">
40+
<a
41+
rel="noreferrer noopener"
42+
href={song.song.spotifyUrl}
43+
target="_blank"
44+
data-umami-event="spotify:song-click"
45+
data-umami-event-song={song.song.title}
46+
>
4147
<SpotifySong {...song.song} />
4248
</a>
4349
))}

0 commit comments

Comments
 (0)