The modern link attribution platform. Loved by world-class engineering teams at Twilio, Zillow, Jobber, Vercel, Raycast, and more.
TypeScript clickhousemysqlnextjsopen-sourceplanetscaleprismatailwindcsstinybirdtypescriptupstashvercel
add skip_deeplink_preview
Steven Teyb2f01df71844
diff --git a/apps/web/app/app.dub.co/(deeplink)/deeplink/[domain]/[key]/action-buttons.tsx b/apps/web/app/app.dub.co/(deeplink)/deeplink/[domain]/[key]/action-buttons.tsxindex 5d539ce3f0..5a53c47e27 100644--- a/apps/web/app/app.dub.co/(deeplink)/deeplink/[domain]/[key]/action-buttons.tsx+++ b/apps/web/app/app.dub.co/(deeplink)/deeplink/[domain]/[key]/action-buttons.tsx@@ -3,7 +3,11 @@import { Button, IOSAppStore, useCopyToClipboard } from "@dub/ui";import { Link } from "@prisma/client";-export function DeepLinkActionButtons({ link }: { link: Link }) {+export function DeepLinkActionButtons({+ link,+}: {+ link: Pick<Link, "shortLink">;+}) {const [_copied, copyToClipboard] = useCopyToClipboard();const handleClick = async ({ withCopy }: { withCopy?: boolean } = {}) => {@@ -11,7 +15,7 @@ export function DeepLinkActionButtons({ link }: { link: Link }) {await copyToClipboard(link.shortLink);}- window.location.href = link.shortLink;+ window.location.href = `${link.shortLink}?skip_deeplink_preview=1`;};return (diff --git a/apps/web/app/app.dub.co/(deeplink)/deeplink/[domain]/[key]/brand-logo-badge.tsx b/apps/web/app/app.dub.co/(deeplink)/deeplink/[domain]/[key]/brand-logo-badge.tsxindex e9bb0f88cf..c9d0993e2a 100644--- a/apps/web/app/app.dub.co/(deeplink)/deeplink/[domain]/[key]/brand-logo-badge.tsx+++ b/apps/web/app/app.dub.co/(deeplink)/deeplink/[domain]/[key]/brand-logo-badge.tsx@@ -4,14 +4,18 @@ import { useCopyToClipboard } from "@dub/ui";import { getApexDomain, GOOGLE_FAVICON_URL } from "@dub/utils";import { Link } from "@prisma/client";-export function BrandLogoBadge({ link }: { link: Link }) {+export function BrandLogoBadge({+ link,+}: {+ link: Pick<Link, "shortLink" | "url">;+}) {const [_copied, copyToClipboard] = useCopyToClipboard();return (<buttononClick={async () => {await copyToClipboard(link.shortLink);- window.location.href = link.shortLink;+ window.location.href = `${link.shortLink}?skip_deeplink_preview=1`;}}className="inline-flex items-center gap-2 rounded-full bg-white px-3 py-1.5 shadow-lg shadow-black/10 ring-1 ring-neutral-200">diff --git a/apps/web/app/app.dub.co/(deeplink)/deeplink/[domain]/[key]/page.tsx b/apps/web/app/app.dub.co/(deeplink)/deeplink/[domain]/[key]/page.tsxindex 9be7e59d03..2a566c6a73 100644--- a/apps/web/app/app.dub.co/(deeplink)/deeplink/[domain]/[key]/page.tsx+++ b/apps/web/app/app.dub.co/(deeplink)/deeplink/[domain]/[key]/page.tsx@@ -21,6 +21,10 @@ export default async function DeepLinkPreviewPage({key,},},+ select: {+ shortLink: true,+ url: true,+ },});if (!link) {diff --git a/apps/web/lib/middleware/link.ts b/apps/web/lib/middleware/link.tsindex f8ed5203db..d48ca2b020 100644--- a/apps/web/lib/middleware/link.ts+++ b/apps/web/lib/middleware/link.ts@@ -411,8 +411,12 @@ export default async function LinkMiddleware(}),);- // if it's an iOS app store URL, we need to show the interstitial page + cache deep link click data- if (isIosAppStoreUrl(ios)) {+ // if it's an iOS app store URL (and skip_deeplink_preview is not set)+ // we need to show the interstitial page + cache deep link click data+ if (+ isIosAppStoreUrl(ios) &&+ !req.nextUrl.searchParams.get("skip_deeplink_preview")+ ) {ev.waitUntil(cacheDeepLinkClickData({req,