Skip to content

Commit e23698a

Browse files
committed
feat: add tracking for directories
1 parent 5813ef2 commit e23698a

File tree

1 file changed

+12
-4
lines changed

1 file changed

+12
-4
lines changed

apps/v4/components/directory-list.tsx

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,14 @@ import {
1616
ItemTitle,
1717
} from "@/registry/new-york-v4/ui/item"
1818

19+
function getHomepageUrl(homepage: string) {
20+
const url = new URL(homepage)
21+
url.searchParams.set("utm_source", "ui.shadcn.com")
22+
url.searchParams.set("utm_medium", "referral")
23+
url.searchParams.set("utm_campaign", "directory")
24+
return url.toString()
25+
}
26+
1927
export function DirectoryList() {
2028
return (
2129
<ItemGroup className="my-8">
@@ -30,9 +38,9 @@ export function DirectoryList() {
3038
<ItemContent>
3139
<ItemTitle>
3240
<a
33-
href={registry.homepage}
41+
href={getHomepageUrl(registry.homepage)}
3442
target="_blank"
35-
rel="noopener noreferrer"
43+
rel="noopener noreferrer external"
3644
>
3745
{registry.name}
3846
</a>
@@ -46,9 +54,9 @@ export function DirectoryList() {
4654
<ItemActions className="relative z-10 hidden self-start sm:flex">
4755
<Button size="sm" variant="outline" asChild>
4856
<a
49-
href={registry.homepage}
57+
href={getHomepageUrl(registry.homepage)}
5058
target="_blank"
51-
rel="noopener noreferrer"
59+
rel="noopener noreferrer external"
5260
>
5361
View <IconArrowUpRight />
5462
</a>

0 commit comments

Comments
 (0)