Skip to content

Commit 3a48c1e

Browse files
committed
tracking
1 parent 9bebf1f commit 3a48c1e

File tree

2 files changed

+9
-0
lines changed

2 files changed

+9
-0
lines changed

src/components/overrides/TableOfContents.astro

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ const tags = Astro.locals.starlightRoute.entry.data.tags;
1818
<a
1919
href={`/search/?tags=${tag}`}
2020
class="rounded-sm border border-(--sl-color-hairline) px-3 text-black"
21+
data-tag-serp-link={true}
2122
>
2223
{tag}
2324
</a>

src/scripts/analytics/links.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,14 @@ export function registerLinks() {
1616
for (const el of elements) {
1717
const { hostname, pathname } = new URL(el.href);
1818

19+
if (el.dataset.tagSerpLink) {
20+
el.addEventListener("click", () => {
21+
track("click docs tag", { value: el.innerText });
22+
});
23+
24+
continue;
25+
}
26+
1927
if (hostname === "developers.cloudflare.com" || hostname === "localhost") {
2028
continue;
2129
}

0 commit comments

Comments
 (0)