Skip to content

armgit / dub

Public Imported from GitHub
0

The modern link attribution platform. Loved by world-class engineering teams at Twilio, Zillow, Jobber, Vercel, Raycast, and more.

fixed href for nav and footer

Steven Teye2cebffbf223
diff --git a/app/dub.sh/layout.tsx b/app/dub.sh/layout.tsx
index 3e97096f59..5d0dba3dc7 100644
--- a/app/dub.sh/layout.tsx
+++ b/app/dub.sh/layout.tsx
@@ -7,7 +7,7 @@ import MobileNav from "#/ui/home/nav-mobile";
export default function MarketingLayout(props) {
return (
<MarketingProviders modal={props.modal}>
- <div className="flex min-h-screen flex-col">
+ <div className="flex min-h-screen flex-col justify-between">
<MobileNav />
<Nav />
{props.children}
diff --git a/app/ui/home/footer.tsx b/app/ui/home/footer.tsx
index ad3d2f2263..97b0e882c0 100644
--- a/app/ui/home/footer.tsx
+++ b/app/ui/home/footer.tsx
@@ -4,6 +4,7 @@ import Link from "next/link";
import { Github, LinkedIn, Logo, Twitter } from "@/components/shared/icons";
import { useParams } from "next/navigation";
import MaxWidthWrapper from "@/components/shared/max-width-wrapper";
+import va from "@vercel/analytics";
const navigation = {
product: [{ name: "Pricing", href: "/pricing" }],
@@ -19,16 +20,24 @@ export default function Footer() {
const { domain = "dub.sh" } = useParams() as { domain: string };
const createHref = (href: string) =>
- domain === "dub.sh"
- ? href
- : `https://dub.sh${href}?utm_source=${domain}&utm_medium=referral&utm_campaign=custom-domain`;
+ domain === "dub.sh" ? href : `https://dub.sh${href}`;
return (
<footer className="z-10 border-t border-gray-200 bg-white/50 py-8 backdrop-blur-lg">
<MaxWidthWrapper className="pt-10">
<div className="xl:grid xl:grid-cols-5 xl:gap-8">
<div className="space-y-8 xl:col-span-2">
- <Link href={createHref("/")}>
+ <Link
+ href={createHref("/")}
+ {...(domain !== "dub.sh" && {
+ onClick: () => {
+ va.track("Referred from custom domain", {
+ domain,
+ medium: `footer item (logo)`,
+ });
+ },
+ })}
+ >
<span className="sr-only">Dub.sh Logo</span>
<Logo className="h-7 w-7 text-gray-600" />
</Link>
@@ -77,6 +86,14 @@ export default function Footer() {
<li key={item.name}>
<Link
href={createHref(item.href)}
+ {...(domain !== "dub.sh" && {
+ onClick: () => {
+ va.track("Referred from custom domain", {
+ domain,
+ medium: `footer item (${item.name})`,
+ });
+ },
+ })}
className="text-sm text-gray-500 hover:text-gray-900"
>
{item.name}
@@ -92,6 +109,14 @@ export default function Footer() {
<li key={item.name}>
<Link
href={createHref(item.href)}
+ {...(domain !== "dub.sh" && {
+ onClick: () => {
+ va.track("Referred from custom domain", {
+ domain,
+ medium: `footer item (${item.name})`,
+ });
+ },
+ })}
className="text-sm text-gray-500 hover:text-gray-900"
>
{item.name}
@@ -109,6 +134,14 @@ export default function Footer() {
<li key={item.name}>
<Link
href={createHref(item.href)}
+ {...(domain !== "dub.sh" && {
+ onClick: () => {
+ va.track("Referred from custom domain", {
+ domain,
+ medium: `footer item (${item.name})`,
+ });
+ },
+ })}
className="text-sm text-gray-500 hover:text-gray-900"
>
{item.name}
@@ -124,6 +157,14 @@ export default function Footer() {
<li key={item.name}>
<Link
href={createHref(item.href)}
+ {...(domain !== "dub.sh" && {
+ onClick: () => {
+ va.track("Referred from custom domain", {
+ domain,
+ medium: `footer item (${item.name})`,
+ });
+ },
+ })}
className="text-sm text-gray-500 hover:text-gray-900"
>
{item.name}
diff --git a/app/ui/home/nav.tsx b/app/ui/home/nav.tsx
index d3cbbcc918..a876549ee4 100644
--- a/app/ui/home/nav.tsx
+++ b/app/ui/home/nav.tsx
@@ -6,6 +6,8 @@ import { useParams, useSelectedLayoutSegment } from "next/navigation";
import useScroll from "#/lib/hooks/use-scroll";
import { cn } from "#/lib/utils";
import MaxWidthWrapper from "@/components/shared/max-width-wrapper";
+import { APP_DOMAIN } from "#/lib/constants";
+import va from "@vercel/analytics";
const navItems = ["pricing", "changelog"];
@@ -28,11 +30,15 @@ export default function Nav() {
<MaxWidthWrapper>
<div className="flex h-14 items-center justify-between">
<Link
- href={
- domain === "dub.sh"
- ? "/"
- : `https://dub.sh?utm_source=${domain}&utm_medium=referral&utm_campaign=custom-domain`
- }
+ href={domain === "dub.sh" ? "/" : `https://dub.sh`}
+ {...(domain !== "dub.sh" && {
+ onClick: () => {
+ va.track("Referred from custom domain", {
+ domain,
+ medium: "logo",
+ });
+ },
+ })}
>
<Image
src="/_static/logotype.svg"
@@ -48,10 +54,16 @@ export default function Nav() {
<Link
key={item}
href={
- domain === "dub.sh"
- ? `/${item}`
- : `https://dub.sh/${item}?utm_source=${domain}&utm_medium=referral&utm_campaign=custom-domain`
+ domain === "dub.sh" ? `/${item}` : `https://dub.sh/${item}`
}
+ {...(domain !== "dub.sh" && {
+ onClick: () => {
+ va.track("Referred from custom domain", {
+ domain,
+ medium: `navbar item (${item})`,
+ });
+ },
+ })}
className={`rounded-md text-sm font-medium capitalize ${
segment === item ? "text-black" : "text-gray-500"
} transition-colors ease-out hover:text-black`}
@@ -60,21 +72,29 @@ export default function Nav() {
</Link>
))}
<Link
- href={
- process.env.NEXT_PUBLIC_VERCEL_ENV === "production"
- ? "https://app.dub.sh/login"
- : "http://app.localhost:3000/login"
- }
+ href={`${APP_DOMAIN}/login`}
+ {...(domain !== "dub.sh" && {
+ onClick: () => {
+ va.track("Referred from custom domain", {
+ domain,
+ medium: `navbar item (login)`,
+ });
+ },
+ })}
className="rounded-md text-sm font-medium text-gray-500 transition-colors ease-out hover:text-black"
>
Log in
</Link>
<Link
- href={
- process.env.NEXT_PUBLIC_VERCEL_ENV === "production"
- ? "https://app.dub.sh/register"
- : "http://app.localhost:3000/register"
- }
+ href={`${APP_DOMAIN}/register`}
+ {...(domain !== "dub.sh" && {
+ onClick: () => {
+ va.track("Referred from custom domain", {
+ domain,
+ medium: `navbar item (signup)`,
+ });
+ },
+ })}
className="rounded-full border border-black bg-black px-4 py-1.5 text-sm text-white transition-all hover:bg-white hover:text-black"
>
Sign Up