Skip to content

Improving the analytics setup prompts#3528

Open
marcusljf wants to merge 3 commits intomainfrom
conversion-tracking-ai-prompting
Open

Improving the analytics setup prompts#3528
marcusljf wants to merge 3 commits intomainfrom
conversion-tracking-ai-prompting

Conversation

@marcusljf
Copy link
Collaborator

@marcusljf marcusljf commented Mar 4, 2026

Dropdown

  • Updated all the logos
  • Changed Anthropic to Claude
  • Added Codex and Cursor
  • Unified the language
  • Change the main guide button to "View docs"

When opening in selected app, the prompt:

  • is different based on the Step 1 selections
  • asks for the publishable key for security
  • asks for outbound domains
  • asks if the user is setting up client-side click tracking
  • always shows the documentation link at the bottom

Other

  • Steps 2 and 3 are updated to behave the same and show the doc link at the bottom now. So the LLMs have sources for everything.
  • Still copies section as markdown if the user wants
CleanShot 2026-03-04 at 15 32 49@2x
CleanShot.2026-03-04.at.15.19.28.mp4

Summary by CodeRabbit

  • New Features

    • Added "Open in Cursor" and "Open in Codex" quick-access buttons for guides.
    • Implemented dynamic prompt generation tailored to specific guide types (client-sdk, track-lead, track-sale).
  • Improvements

    • Updated guide action button labels: "Copy as Markdown for LLMs" and "View docs" for clarity.
    • Enhanced prompt handling with specialized content for React guides.
  • UI Updates

    • Added new Cursor and Codex icon components.

@vercel
Copy link
Contributor

vercel bot commented Mar 4, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
dub Ready Ready Preview Mar 5, 2026 0:32am

Request Review

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Mar 4, 2026

📝 Walkthrough

Walkthrough

The PR enhances the guide-action-button component with dynamic prompt generation logic tailored to different guide types and SDK platforms. Three new UI actions are introduced for opening guides in Cursor and Codex editors, plus updated icon components. Helper functions generate specialized prompts for client-SDK guides (with React-specific handling) and sanitize markdown content for safe embedding.

Changes

Cohort / File(s) Summary
Guide Action Button Logic
apps/web/ui/guides/guide-action-button.tsx
Adds dynamic client-side prompt generation with guide-type differentiation (client-sdk, track-lead, track-sale). Implements specialized prompts for SDK variants (React, Shopify, etc.) with markdown sanitization. Introduces new dropdown actions for Cursor and Codex, retains ChatGPT/Claude options. Updates UI copy and removes debugging log.
Icon Components
packages/ui/src/icons/anthropic.tsx, packages/ui/src/icons/codex.tsx, packages/ui/src/icons/cursor.tsx
Updates Anthropic icon SVG path definition. Adds two new React SVG icon components (Codex and Cursor) that accept className and SVGProps, rendering fixed-dimension icons with currentColor fill.
Icon Exports
packages/ui/src/icons/index.tsx
Adds centralized re-exports for newly created Codex and Cursor icon components.

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

Possibly related PRs

  • dubinc/dub#2936: Directly modifies guide-action-button.tsx with overlapping changes to guide action UI and prompt-generation logic.
  • dubinc/dub#2787: Modifies the guide UI action dropdown and adds related icon exports for copy-as-Markdown and AI editor integrations.

Suggested reviewers

  • steven-tey
  • pepeladeira

Poem

🐰 A guide grows smarter with prompts so bright,
Dynamic and swift, for Cursor and Codex's delight!
React takes the lead with specialized care,
Icons spin round—a trifecta so fair! ✨

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The PR title accurately describes the main objective of improving analytics setup prompts, which is reflected in the changes to guide-action-button.tsx that introduce dynamic prompt generation based on guide type and adds specialized prompts for client-side tracking.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
  • 📝 Generate docstrings (stacked PR)
  • 📝 Generate docstrings (commit on current branch)
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch conversion-tracking-ai-prompting

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🧹 Nitpick comments (1)
packages/ui/src/icons/codex.tsx (1)

16-16: Prefer currentColor to keep Codex icon theme-aware.

At Line 16, fixed fill prevents parent color classes from applying. Using currentColor keeps behavior consistent with other menu icons.

Suggested fix
-        fill="#262626"
+        fill="currentColor"
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@packages/ui/src/icons/codex.tsx` at line 16, The Codex icon component in
codex.tsx currently hardcodes fill="#262626"; update the SVG element(s) in that
component (look for the fill="#262626" attribute) to use fill="currentColor" so
the icon inherits parent color classes and remains theme-aware.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@apps/web/ui/guides/guide-action-button.tsx`:
- Around line 112-127: The generated React snippet places the analytics
component outside the <body>, producing invalid Next.js RootLayout markup;
update the RootLayout function so that analyticsComponent (the <DubAnalytics />
markup) is rendered inside the <body> alongside {children} — locate the
RootLayout export and move the analyticsComponent reference into the <body>
element (ensure the <html> contains only <body> and that analyticsComponent is
rendered as part of body children, e.g., inside the body tag with {children}) so
the component is not outside the body.

In `@packages/ui/src/icons/openai.tsx`:
- Line 16: The SVG in packages/ui/src/icons/openai.tsx currently hardcodes
fill="#262626", which prevents consumer className color utilities from working;
update the SVG path(s) or shape fill attributes to use "currentColor" instead of
the hex value so the OpenAI icon respects parent text color (e.g.,
className="text-...") when rendered (locate the fill attribute inside the OpenAI
icon component in this file and replace the literal with "currentColor").

---

Nitpick comments:
In `@packages/ui/src/icons/codex.tsx`:
- Line 16: The Codex icon component in codex.tsx currently hardcodes
fill="#262626"; update the SVG element(s) in that component (look for the
fill="#262626" attribute) to use fill="currentColor" so the icon inherits parent
color classes and remains theme-aware.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 8788e693-aeff-4381-8ce1-0fc0048cac4c

📥 Commits

Reviewing files that changed from the base of the PR and between 05483df and ce1ad8c.

📒 Files selected for processing (6)
  • apps/web/ui/guides/guide-action-button.tsx
  • packages/ui/src/icons/anthropic.tsx
  • packages/ui/src/icons/codex.tsx
  • packages/ui/src/icons/cursor.tsx
  • packages/ui/src/icons/index.tsx
  • packages/ui/src/icons/openai.tsx

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

♻️ Duplicate comments (1)
apps/web/ui/guides/guide-action-button.tsx (1)

112-124: ⚠️ Potential issue | 🟠 Major

Move analyticsComponent inside <body> in the generated React snippet.

At Line 122 and Line 123, the generated example places ${analyticsComponent} as a sibling of <body>, which produces invalid RootLayout markup when copied.

Suggested fix
   return (
     <html lang="en">
-      <body>{children}</body>
-      ${analyticsComponent}
+      <body>
+        {children}
+        ${analyticsComponent}
+      </body>
     </html>
   );
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@apps/web/ui/guides/guide-action-button.tsx` around lines 112 - 124, The
generated example in RootLayout places analyticsComponent outside the <body>,
producing invalid markup; update the snippet so that analyticsComponent is
rendered inside the <body> (e.g., render {children} and then include
${analyticsComponent} before the closing </body>), locating the change in the
RootLayout example where children and analyticsComponent are returned.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Duplicate comments:
In `@apps/web/ui/guides/guide-action-button.tsx`:
- Around line 112-124: The generated example in RootLayout places
analyticsComponent outside the <body>, producing invalid markup; update the
snippet so that analyticsComponent is rendered inside the <body> (e.g., render
{children} and then include ${analyticsComponent} before the closing </body>),
locating the change in the RootLayout example where children and
analyticsComponent are returned.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: b847e9c2-c88c-49dd-a03c-93a829ef5336

📥 Commits

Reviewing files that changed from the base of the PR and between ce1ad8c and bdc81ed.

📒 Files selected for processing (1)
  • apps/web/ui/guides/guide-action-button.tsx

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🧹 Nitpick comments (1)
apps/web/ui/guides/guide-action-button.tsx (1)

240-320: Refactor repeated AI action buttons into a config map.

The ChatGPT/Claude/Cursor/Codex blocks repeat nearly identical markup and interaction wiring. Converting this to a data-driven render path will reduce drift and future update cost.

♻️ Suggested refactor shape
+const aiActions = [
+  {
+    label: "Open in ChatGPT",
+    subtitle: "Ask questions about this step",
+    Icon: OpenAI,
+    getUrl: (prompt: string) =>
+      `https://chatgpt.com?hints=search&prompt=${encodeURIComponent(prompt)}`,
+  },
+  {
+    label: "Open in Claude",
+    subtitle: "Ask questions about this step",
+    Icon: Anthropic,
+    getUrl: (prompt: string) =>
+      `https://claude.ai/new?q=${encodeURIComponent(prompt)}`,
+  },
+  {
+    label: "Open in Cursor",
+    subtitle: "Ask questions about this step",
+    Icon: Cursor,
+    getUrl: (prompt: string) =>
+      `https://cursor.com/link/prompt?text=${encodeURIComponent(prompt)}`,
+  },
+  {
+    label: "Open in Codex",
+    subtitle: "Ask questions about this step",
+    Icon: Codex,
+    getUrl: (prompt: string) =>
+      `https://chatgpt.com/codex?prompt=${encodeURIComponent(prompt)}`,
+  },
+];
...
-<button>...</button> // repeated x4
+{aiActions.map(({ label, subtitle, Icon, getUrl }) => (
+  <button
+    key={label}
+    className="flex w-full cursor-pointer items-center gap-2 rounded-md p-2 text-sm text-neutral-600 transition-colors hover:bg-neutral-100"
+    onClick={() => window.open(getUrl(prompt), "_blank", "noopener,noreferrer")}
+  >
+    <div className="flex h-8 w-8 items-center justify-center rounded border border-neutral-200 transition-colors hover:border-neutral-300">
+      <Icon className="size-4 text-neutral-600" />
+    </div>
+    <div className="flex flex-1 flex-col items-start">
+      <div className="flex items-center gap-1">
+        <span className="font-medium">{label}</span>
+        <ArrowUpRight className="size-3.5 text-neutral-600" />
+      </div>
+      <span className="text-xs text-neutral-500">{subtitle}</span>
+    </div>
+  </button>
+))}
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@apps/web/ui/guides/guide-action-button.tsx` around lines 240 - 320, The four
nearly identical button blocks (rendering ChatGPT, Claude, Cursor, Codex)
duplicate markup and click logic; replace them with a data-driven config array
(e.g., providers = [{ key:'chatgpt', label:'Open in ChatGPT', icon: OpenAI, url:
p => `https://chatgpt.com?hints=search&prompt=${encodeURIComponent(p)}` }, ...])
that uses the existing identifiers prompt, cursorUrl, codexUrl, OpenAI,
Anthropic, Cursor, Codex and ArrowUpRight, then map over providers to render a
single Button JSX template that calls window.open(provider.url(promptOrUrls))
and preserves all classes/structure and aria/title text; ensure provider entries
that need full URLs (cursorUrl/codexUrl) accept the precomputed value while
others build from prompt.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@apps/web/ui/guides/guide-action-button.tsx`:
- Around line 137-139: The early return in guide-action-button.tsx that checks
guide.type === "client-sdk" && guide.key === "shopify" causes Shopify to skip
the setup-question flow and standardized footer; remove or refactor that
special-case return so Shopify follows the same client-sdk branch logic that
triggers the publishable-key/outbound-domain/click-tracking prompts and the
shared footer formatting. Locate the conditional using guide.type and guide.key
and either drop the shopify-specific return or fold its messaging into the
existing client-sdk flow so the same prompts and footer are produced for shopify
as for other client-sdk keys.

---

Nitpick comments:
In `@apps/web/ui/guides/guide-action-button.tsx`:
- Around line 240-320: The four nearly identical button blocks (rendering
ChatGPT, Claude, Cursor, Codex) duplicate markup and click logic; replace them
with a data-driven config array (e.g., providers = [{ key:'chatgpt', label:'Open
in ChatGPT', icon: OpenAI, url: p =>
`https://chatgpt.com?hints=search&prompt=${encodeURIComponent(p)}` }, ...]) that
uses the existing identifiers prompt, cursorUrl, codexUrl, OpenAI, Anthropic,
Cursor, Codex and ArrowUpRight, then map over providers to render a single
Button JSX template that calls window.open(provider.url(promptOrUrls)) and
preserves all classes/structure and aria/title text; ensure provider entries
that need full URLs (cursorUrl/codexUrl) accept the precomputed value while
others build from prompt.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 9a795311-3ab9-4c67-8169-cad883c9187a

📥 Commits

Reviewing files that changed from the base of the PR and between bdc81ed and d32904a.

📒 Files selected for processing (2)
  • apps/web/ui/guides/guide-action-button.tsx
  • packages/ui/src/icons/codex.tsx
🚧 Files skipped from review as they are similar to previous changes (1)
  • packages/ui/src/icons/codex.tsx

Comment on lines +137 to +139
if (guide.type === "client-sdk" && guide.key === "shopify") {
return `Read from ${guide.url} so I can ask questions about it.`;
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

Shopify branch bypasses the new setup-question flow.

At Line 137Line 139, the early return for guide.key === "shopify" skips the publishable-key/outbound-domain/click-tracking prompts and the standardized footer format used by other client SDK options, making Shopify behavior inconsistent.

💡 Proposed fix
 function getGuidePrompt(guide: IntegrationGuide, markdown: string) {
-  if (guide.type === "client-sdk" && guide.key === "shopify") {
-    return `Read from ${guide.url} so I can ask questions about it.`;
-  }
-
   if (guide.type === "client-sdk" && guide.key === "react") {
     return getReactStepOnePrompt(markdown, guide);
   }

   if (guide.type === "client-sdk") {
     const conversionTrackingEnabled = CONVERSION_TRACKING_PATTERNS.some((pattern) =>
       pattern.test(markdown),
     );
     const outboundTrackingEnabled = isOutboundDomainTrackingEnabled(markdown);
     const sanitizedMarkdown = sanitizeClientScriptMarkdown(markdown);

     return [
-      "I'm using Dub and need to install the client-side script.",
+      guide.key === "shopify"
+        ? "I'm using Dub with Shopify and need to install client-side tracking."
+        : "I'm using Dub and need to install the client-side script.",
       "Help me add the script from the instructions below.",
       conversionTrackingEnabled
         ? "Ask me for my publishable key before finalizing the conversion tracking setup."
         : null,
       "Ask me if I want to enable client-side click tracking (Dub Partners). If yes, add `domainsConfig.refer` with my referring domain.",
       outboundTrackingEnabled
         ? "Ask me which outbound domains I want to track before finalizing the setup."
         : null,
       "Instructions:",
       sanitizedMarkdown,
       `Full guide link for reference: ${guide.url}`,
     ]
       .filter(Boolean)
       .join("\n\n");
   }
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
if (guide.type === "client-sdk" && guide.key === "shopify") {
return `Read from ${guide.url} so I can ask questions about it.`;
}
function getGuidePrompt(guide: IntegrationGuide, markdown: string) {
if (guide.type === "client-sdk" && guide.key === "react") {
return getReactStepOnePrompt(markdown, guide);
}
if (guide.type === "client-sdk") {
const conversionTrackingEnabled = CONVERSION_TRACKING_PATTERNS.some((pattern) =>
pattern.test(markdown),
);
const outboundTrackingEnabled = isOutboundDomainTrackingEnabled(markdown);
const sanitizedMarkdown = sanitizeClientScriptMarkdown(markdown);
return [
guide.key === "shopify"
? "I'm using Dub with Shopify and need to install client-side tracking."
: "I'm using Dub and need to install the client-side script.",
"Help me add the script from the instructions below.",
conversionTrackingEnabled
? "Ask me for my publishable key before finalizing the conversion tracking setup."
: null,
"Ask me if I want to enable client-side click tracking (Dub Partners). If yes, add `domainsConfig.refer` with my referring domain.",
outboundTrackingEnabled
? "Ask me which outbound domains I want to track before finalizing the setup."
: null,
"Instructions:",
sanitizedMarkdown,
`Full guide link for reference: ${guide.url}`,
]
.filter(Boolean)
.join("\n\n");
}
}
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@apps/web/ui/guides/guide-action-button.tsx` around lines 137 - 139, The early
return in guide-action-button.tsx that checks guide.type === "client-sdk" &&
guide.key === "shopify" causes Shopify to skip the setup-question flow and
standardized footer; remove or refactor that special-case return so Shopify
follows the same client-sdk branch logic that triggers the
publishable-key/outbound-domain/click-tracking prompts and the shared footer
formatting. Locate the conditional using guide.type and guide.key and either
drop the shopify-specific return or fold its messaging into the existing
client-sdk flow so the same prompts and footer are produced for shopify as for
other client-sdk keys.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant