Skip to content

armgit / macro

Public Imported from GitHub
0

Macro is a unified workspace for teams: email, chat, docs, tasks, agents, calls, and CRM — @-linked together with shared AI memory.

fix(marketing): open the booking dialog for links with tracking parameters (#8009)

Chaitanya Agarwalf0f4a2f13aca
diff --git a/apps/marketing/src/features/marketing/components/DemoBookingDialog.test.tsx b/apps/marketing/src/features/marketing/components/DemoBookingDialog.test.tsx
index d0ceea7d7f..820b4e7733 100644
--- a/apps/marketing/src/features/marketing/components/DemoBookingDialog.test.tsx
+++ b/apps/marketing/src/features/marketing/components/DemoBookingDialog.test.tsx
@@ -97,6 +97,16 @@ it('books in a dialog on the page and returns focus to the link when closed', as
await waitFor(() => expect(document.activeElement).toBe(link));
});
+it('opens for a link an analytics script has added tracking parameters to', async () => {
+ const link = renderSite() as HTMLAnchorElement;
+ link.href = `${DEMO_BOOKING_URL}?_gl=1*abc`;
+
+ const { frame, followed } = await openDialog();
+
+ expect(followed).toBe(false);
+ expect(frame.getAttribute('src')).toBe(BOOKING_PATH);
+});
+
it('leaves new-tab clicks and other links to the browser', () => {
const link = renderSite();
diff --git a/apps/marketing/src/features/marketing/components/DemoBookingDialog.tsx b/apps/marketing/src/features/marketing/components/DemoBookingDialog.tsx
index 40a67d2796..0a71f6e7d2 100644
--- a/apps/marketing/src/features/marketing/components/DemoBookingDialog.tsx
+++ b/apps/marketing/src/features/marketing/components/DemoBookingDialog.tsx
@@ -51,7 +51,9 @@ export function DemoBookingDialog() {
return;
if (!(event.target instanceof Element)) return;
const link = event.target.closest('a');
- if (link?.href !== DEMO_BOOKING_URL) return;
+ // Compared without the query: analytics scripts append tracking
+ // parameters to a link as it is pressed.
+ if (!link || link.origin + link.pathname !== DEMO_BOOKING_URL) return;
event.preventDefault();
opener = link;
changeOpen(true);