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.

final changes

Steven Tey9900bf0892de
diff --git a/apps/web/app/app.dub.co/(dashboard)/[slug]/settings/analytics/use-dynamic-guide.ts b/apps/web/app/app.dub.co/(dashboard)/[slug]/settings/analytics/use-dynamic-guide.ts
index 31c816ddcf..a128335267 100644
--- a/apps/web/app/app.dub.co/(dashboard)/[slug]/settings/analytics/use-dynamic-guide.ts
+++ b/apps/web/app/app.dub.co/(dashboard)/[slug]/settings/analytics/use-dynamic-guide.ts
@@ -59,13 +59,20 @@ export function useDynamicGuide(
if (conversionTrackingEnabled && publishableKey) {
result = result
+ // for manual installations
?.replaceAll(
/^(\s+)(data-domains=.+)$/gm,
`$1$2\n$1data-publishable-key="${publishableKey}"`,
)
+ // for React applications
?.replaceAll(
/^(\s+)(.+)(domainsConfig={{)/gm,
`$1$2publishableKey="${publishableKey}" $3`,
+ )
+ // for GTM installations
+ ?.replaceAll(
+ /^(\s+)(script\.dataset\.domains\s*=\s*.+)$/gm,
+ `$1$2\n$1script.setAttribute("data-publishable-key", "${publishableKey}");`,
);
}
diff --git a/apps/web/guides/gtm-client-sdk.md b/apps/web/guides/gtm-client-sdk.md
index 8c54552527..ae2ddf261b 100644
--- a/apps/web/guides/gtm-client-sdk.md
+++ b/apps/web/guides/gtm-client-sdk.md
@@ -14,8 +14,8 @@ First, navigate to your Google Tag Manager account and create a new tag:
In the Custom HTML section, you’ll need to add the Dub client-side script. Copy and paste the following code into the **HTML** field:
+<!-- prettier-ignore -->
```js
-// prettier-ignore
<script>
var script = document.createElement("script");
script.defer = true;
@@ -30,7 +30,6 @@ If you’re using [Dub Partners](https://dub.co/docs/partners/quickstart) for af
```js
<script>
- ...
var script = document.createElement("script");
script.defer = true;
script.src = "https://www.dubcdn.com/analytics/script.js";
diff --git a/apps/web/guides/gtm-track-lead.md b/apps/web/guides/gtm-track-lead.md
index 076b896515..00740227bc 100644
--- a/apps/web/guides/gtm-track-lead.md
+++ b/apps/web/guides/gtm-track-lead.md
@@ -2,7 +2,7 @@ Configure Google Tag Manager for lead tracking
The following steps assume that you've already installed the Dub Analytics script through GTM.
-## Step 1: Create a GTM Variable to Read the dub_id Cookie
+## Step 1: Create a GTM Variable to read the dub_id Cookie
To read the `dub_id` cookie that Dub Analytics sets, you'll need to create a new **User-Defined Variable** in Google Tag Manager.
diff --git a/apps/web/ui/guides/integrations.ts b/apps/web/ui/guides/integrations.ts
index 2a6932482b..bad5247cd3 100644
--- a/apps/web/ui/guides/integrations.ts
+++ b/apps/web/ui/guides/integrations.ts
@@ -125,6 +125,13 @@ export const guides: IntegrationGuide[] = [
icon: Segment,
url: "https://dub.co/docs/conversions/leads/segment",
},
+ {
+ type: "track-lead",
+ key: "gtm-track-lead",
+ title: "Google Tag Manager",
+ icon: GoogleTagManager,
+ url: "https://dub.co/docs/conversions/leads/google-tag-manager",
+ },
{
type: "track-lead",
key: "clerk",
@@ -167,13 +174,6 @@ export const guides: IntegrationGuide[] = [
icon: Appwrite,
url: "https://dub.co/docs/conversions/leads/appwrite",
},
- {
- type: "track-lead",
- key: "gtm-track-lead",
- title: "Google Tag Manager",
- icon: GoogleTagManager,
- url: "https://dub.co/docs/conversions/leads/google-tag-manager",
- },
// Track Sales
{
diff --git a/apps/web/ui/guides/markdown.tsx b/apps/web/ui/guides/markdown.tsx
index 9fcccb238e..66332b4703 100644
--- a/apps/web/ui/guides/markdown.tsx
+++ b/apps/web/ui/guides/markdown.tsx
@@ -15,6 +15,9 @@ export function GuidesMarkdown({
className?: string;
components?: any;
}) {
+ // Remove HTML comments from markdown before rendering
+ const filteredMarkdown = children.replace(/<!--[\s\S]*?-->/g, "");
+
return (
<ReactMarkdown
className={cn(
@@ -78,7 +81,7 @@ export function GuidesMarkdown({
}}
remarkPlugins={[remarkGfm] as any}
>
- {children}
+ {filteredMarkdown}
</ReactMarkdown>
);
}