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): show the App Store link only on iOS after mobile signup (#8587)

juliawest8c47daa5cce2
diff --git a/apps/marketing/src/app/routes/RouteMobileSignupSent.tsx b/apps/marketing/src/app/routes/RouteMobileSignupSent.tsx
index 2d1d7b4b7d..1deae956f7 100644
--- a/apps/marketing/src/app/routes/RouteMobileSignupSent.tsx
+++ b/apps/marketing/src/app/routes/RouteMobileSignupSent.tsx
@@ -1,9 +1,10 @@
import { useLocation } from '@solidjs/router';
-import { type Component, onMount, Show } from 'solid-js';
+import { type Component, createSignal, onMount, Show } from 'solid-js';
import { MobileSignupMark } from '../components/graphics/MobileSignupMark';
import { analytics } from '../utils/utilAnalytic';
import {
conversionAlreadyFired,
+ isIOS,
MOBILE_WEB_SIGNUP_LEAD_VALUE,
markConversionFired,
submittedEmail,
@@ -15,7 +16,8 @@ const APP_STORE_URL = 'https://apps.apple.com/us/app/macro-app/id6743133649';
/**
* Confirmation step of the site's mobile email capture: the visitor has been
- * emailed a link to finish signing up on a computer.
+ * emailed a link to finish signing up on a computer. iOS visitors are also
+ * offered the App Store app; there is no Android app.
*
* This page also owns the ad-platform conversions for the captured lead (Meta
* Lead + CompleteRegistration, Google Ads `mobile_web_lead`) — they used to
@@ -37,7 +39,12 @@ export const RouteMobileSignupSent: Component = () => {
// survives a refresh; session storage covers a fresh tab in the same session).
const email = (): string | null => location.state?.email ?? submittedEmail();
+ // Hidden in the prerendered page; only the browser knows the platform.
+ const [showAppStore, setShowAppStore] = createSignal(false);
+
onMount(() => {
+ setShowAppStore(isIOS(navigator.userAgent, navigator.maxTouchPoints));
+
// The email field can stay focused across this route change — force the
// keyboard down even if blur-before-navigate was skipped somehow.
(document.activeElement as HTMLElement | null)?.blur?.();
@@ -90,22 +97,24 @@ export const RouteMobileSignupSent: Component = () => {
)}
</Show>
</p>
- <div class="mobile-signup-card-body">
- <a
- href={APP_STORE_URL}
- class="mobile-signup-card-pill"
- target="_blank"
- rel="noreferrer"
- onClick={() => {
- analytics.track('app_redirect', {
- page_location: window.location.href,
- button_name: 'mobile_signup_sent_app_store',
- });
- }}
- >
- Download our mobile app
- </a>
- </div>
+ <Show when={showAppStore()}>
+ <div class="mobile-signup-card-body">
+ <a
+ href={APP_STORE_URL}
+ class="mobile-signup-card-pill"
+ target="_blank"
+ rel="noreferrer"
+ onClick={() => {
+ analytics.track('app_redirect', {
+ page_location: window.location.href,
+ button_name: 'mobile_signup_sent_app_store',
+ });
+ }}
+ >
+ Download our mobile app
+ </a>
+ </div>
+ </Show>
</section>
);
};
diff --git a/apps/marketing/src/app/utils/utilMobileSignup.test.ts b/apps/marketing/src/app/utils/utilMobileSignup.test.ts
new file mode 100644
index 0000000000..263720c48c
--- /dev/null
+++ b/apps/marketing/src/app/utils/utilMobileSignup.test.ts
@@ -0,0 +1,14 @@
+import { describe, expect, it } from 'vitest';
+import { isIOS } from './utilMobileSignup';
+
+describe('isIOS', () => {
+ it.each([
+ ['Mozilla/5.0 (iPhone; CPU iPhone OS 18_0 like Mac OS X)', 5, true],
+ ['Mozilla/5.0 (iPad; CPU OS 17_0 like Mac OS X)', 5, true],
+ ['Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7)', 5, true],
+ ['Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7)', 0, false],
+ ['Mozilla/5.0 (Linux; Android 14; Pixel 8)', 5, false],
+ ])('%s with %i touch points → %s', (userAgent, maxTouchPoints, expected) => {
+ expect(isIOS(userAgent, maxTouchPoints)).toBe(expected);
+ });
+});
diff --git a/apps/marketing/src/app/utils/utilMobileSignup.ts b/apps/marketing/src/app/utils/utilMobileSignup.ts
index 41d7e0c730..2a3b23de8c 100644
--- a/apps/marketing/src/app/utils/utilMobileSignup.ts
+++ b/apps/marketing/src/app/utils/utilMobileSignup.ts
@@ -26,6 +26,14 @@ export const MOBILE_SIGNUP_SENT_PATH = '/mobile-signup-sent';
*/
export const MOBILE_WEB_SIGNUP_LEAD_VALUE = 5;
+/**
+ * True on iPhone, iPod, and iPad — the only phones with a Macro app. iPadOS
+ * Safari reports itself as a Mac, so a touch-capable "Macintosh" counts too.
+ */
+export const isIOS = (userAgent: string, maxTouchPoints: number): boolean =>
+ /iPhone|iPad|iPod/.test(userAgent) ||
+ (/Macintosh/.test(userAgent) && maxTouchPoints > 1);
+
// Survives the navigation from the capture step to the confirmation step (and a
// refresh of it), which is where the conversions fire.
const SUBMITTED_EMAIL_KEY = 'macro_mobile_signup_email';