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.

exclude <CheckConversionScript />

Steven Teyebc12c2c1d44
diff --git a/apps/web/app/api/links/check-conversion-script/route.ts b/apps/web/app/api/links/check-conversion-script/route.ts
index dc92a2c2a7..f04fb5a4de 100644
--- a/apps/web/app/api/links/check-conversion-script/route.ts
+++ b/apps/web/app/api/links/check-conversion-script/route.ts
@@ -4,23 +4,6 @@ import { getUrlQuerySchema } from "@/lib/zod/schemas/links";
import { fetchWithTimeout } from "@dub/utils";
import { NextRequest, NextResponse } from "next/server";
-// ping URL to see if the dubcdn.com/analytics/script.js script is installed
-const checkFunction = async (url: string) => {
- const res = await fetchWithTimeout(url, {
- headers: {
- "User-Agent": "Dub.co Bot",
- },
- });
-
- if (res.status !== 200) {
- throw new Error(`Failed to fetch ${url}`);
- }
-
- const html = await res.text();
- const isInstalled = html.includes("dubcdn.com/analytics/script.js");
- return isInstalled;
-};
-
export const runtime = "edge";
export async function GET(req: NextRequest) {
@@ -31,7 +14,20 @@ export async function GET(req: NextRequest) {
await ratelimitOrThrow(req, "check-conversion-script");
- const installed = await checkFunction(url);
+ // ping URL to see if the dubcdn.com/analytics/script.js script is installed
+ const res = await fetchWithTimeout(url, {
+ headers: {
+ "User-Agent": "Dub.co Bot",
+ },
+ });
+
+ if (res.status !== 200) {
+ throw new Error(`Failed to fetch ${url}`);
+ }
+
+ const html = await res.text();
+
+ const installed = html.includes("dubcdn.com/analytics/script.js");
return NextResponse.json({ installed });
} catch (error) {
diff --git a/apps/web/ui/modals/add-edit-link-modal/conversion-section.tsx b/apps/web/ui/modals/add-edit-link-modal/conversion-section.tsx
index 8ac4ad291c..24ac41e1d8 100644
--- a/apps/web/ui/modals/add-edit-link-modal/conversion-section.tsx
+++ b/apps/web/ui/modals/add-edit-link-modal/conversion-section.tsx
@@ -2,12 +2,7 @@ import { LinkProps } from "@/lib/types";
import { AlertCircleFill, CheckCircleFill } from "@/ui/shared/icons";
import { LoadingSpinner, SimpleTooltipContent, Switch } from "@dub/ui";
import { BadgeTooltip } from "@dub/ui/src/tooltip";
-import {
- FADE_IN_ANIMATION_SETTINGS,
- fetcher,
- getUrlFromString,
-} from "@dub/utils";
-import { motion } from "framer-motion";
+import { fetcher } from "@dub/utils";
import { FlaskConical } from "lucide-react";
import { Dispatch, SetStateAction, useEffect, useState } from "react";
import useSWR from "swr";
@@ -59,11 +54,11 @@ export default function ConversionSection({
<Switch fn={() => setEnabled(!enabled)} checked={enabled} />
</div>
- {enabled && (
+ {/* {enabled && (
<motion.div className="mt-3" {...FADE_IN_ANIMATION_SETTINGS}>
<CheckConversionScript url={getUrlFromString(data.url)} />
</motion.div>
- )}
+ )} */}
</div>
);
}