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.

disable conversion tracking when publishableKey enabled

Steven Tey9afac58ebd3b
diff --git a/apps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/settings/analytics/connection-instructions.tsx b/apps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/settings/analytics/connection-instructions.tsx
index e7a02cccaa..5754e3f29a 100644
--- a/apps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/settings/analytics/connection-instructions.tsx
+++ b/apps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/settings/analytics/connection-instructions.tsx
@@ -11,7 +11,7 @@ const ConnectionInstructions = ({}: {}) => {
const guides = allGuides.filter((guide) => guide.type === "client-sdk");
const { selectedGuide, setSelectedGuide } = useSelectedGuide({ guides });
- const { loading, error, guideMarkdown } = useDynamicGuide({
+ const { loading, guideMarkdown } = useDynamicGuide({
guide: selectedGuide.key,
});
diff --git a/apps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/settings/analytics/conversion-tracking-section.tsx b/apps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/settings/analytics/conversion-tracking-section.tsx
index 7dcf7da26b..bab3ee37fd 100644
--- a/apps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/settings/analytics/conversion-tracking-section.tsx
+++ b/apps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/settings/analytics/conversion-tracking-section.tsx
@@ -2,7 +2,7 @@
import useWorkspace from "@/lib/swr/use-workspace";
import { useWorkspaceStore } from "@/lib/swr/use-workspace-store";
-import { Switch } from "@dub/ui";
+import { LockSmall, Switch } from "@dub/ui";
import { motion } from "motion/react";
import { useEffect, useId } from "react";
import { PublishableKeyForm } from "./publishable-key-form";
@@ -56,6 +56,17 @@ const ConversionTrackingSection = () => {
thumbDimensions="size-3"
thumbTranslate="translate-x-3"
fn={setEnabled}
+ {...(publishableKey
+ ? {
+ disabledTooltip:
+ "You need to revoke your current publishable key first before disabling conversion tracking.",
+ thumbIcon: (
+ <div className="flex size-full items-center justify-center">
+ <LockSmall className="size-[8px] text-black" />
+ </div>
+ ),
+ }
+ : {})}
/>
</div>
diff --git a/apps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/settings/analytics/page.tsx b/apps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/settings/analytics/page.tsx
index b6134f5fe3..667614496d 100644
--- a/apps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/settings/analytics/page.tsx
+++ b/apps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/settings/analytics/page.tsx
@@ -4,8 +4,11 @@ import Link from "next/link";
import useWorkspace from "@/lib/swr/use-workspace";
import { useWorkspaceStore } from "@/lib/swr/use-workspace-store";
-import { useLocalStorage, useRouterStuff } from "@dub/ui";
-import { cn } from "@dub/utils";
+import {
+ AnimatedSizeContainer,
+ useLocalStorage,
+ useRouterStuff,
+} from "@dub/ui";
import BaseScriptSection from "./base-script-section";
import { CompleteStepButton } from "./complete-step-button";
import ConnectionInstructions from "./connection-instructions";
@@ -39,40 +42,24 @@ const ConnectStep = ({
expanded={expanded}
toggleExpanded={toggleExpanded}
complete={complete}
- contentClassName="flex flex-col gap-8"
>
- <div
- className={cn(
- "transition-opacity",
- guide === "shopify" && "cursor-not-allowed opacity-50",
- )}
- >
- <div className="flex flex-col gap-3" inert={guide === "shopify"}>
- <BaseScriptSection />
-
- <ConversionTrackingSection />
+ <AnimatedSizeContainer height>
+ {guide !== "shopify" && (
+ <div className="flex flex-col gap-3 pb-8">
+ <BaseScriptSection />
- {flags?.analyticsSettingsSiteVisitTracking && (
- <SiteVisitTrackingSection />
- )}
+ <ConversionTrackingSection />
- <OutboundDomainTrackingSection />
- </div>
- </div>
+ {flags?.analyticsSettingsSiteVisitTracking && (
+ <SiteVisitTrackingSection />
+ )}
- <div className="flex flex-col gap-3">
- <div>
- <div className="font-semibold text-black">
- Connection Instructions
+ <OutboundDomainTrackingSection />
</div>
+ )}
+ </AnimatedSizeContainer>
- <p className="text-content-subtle text-sm font-medium">
- Select your integration method to show specific instructions
- </p>
- </div>
-
- <ConnectionInstructions />
- </div>
+ <ConnectionInstructions />
{!complete && (
<CompleteStepButton