Design a PWA install funnel optimized for Android mini-CTA, iOS share sheet, and desktop…
- User
Design a PWA install funnel optimized for Android mini-CTA, iOS share sheet, and desktop prompts with analytics instrumentation.
Assistant
The user wants a design for a Progressive Web App (PWA) install funnel. This design needs to cover three specific platforms/contexts:
- Android: Optimized for the "mini-CTA" (usually the "Add to Home screen" prompt at the bottom of the screen, or manual installation instructions).
- iOS: Optimized for the "share sheet" flow (since iOS doesn't support the standard Web App Install API automatically).
- Desktop: Optimized for the address bar button or native install prompt.
Crucially, the design must include analytics instrumentation (tracking events) for every step of the funnel.
Key Considerations:
- Platform Detection: The system must accurately detect the OS to show the right UI.
- User Experience (UX): The flow needs to be non-intrusive but persuasive.
- Technical Implementation: Needs to handle the
beforeinstallpromptevent (Android/Desktop) vs. manual instructions (iOS). - Analytics: Define specific events (e.g.,
prompt_shown,button_clicked,install_accepted,install_dismissed) to measure conversion rates.
Structure of the Response:
- Strategy & UX Flow: High-level overview of how the funnel works per platform.
- Analytics Schema: Define the events to track.
- Technical Implementation (Code/Logic):
- Detection logic.
- Android/Desktop (intercepting the native prompt).
- iOS (custom modal/instructions).
- UI/Visual Design Guidelines: How the UI elements should look.
- Code Example: A concrete React/Vanilla JS snippet illustrating the logic.
Drafting the Content - Step-by-Step:
-
Phase 1: The Funnel Stages
- Trigger: User visits, meets criteria (PWA manifest, service worker, engagement).
- Presentation: Show the prompt.
- Action: User clicks install or cancels.
- Result: App installed or funnel exited.
-
Phase 2: Platform Specifics
- Android: Can capture the
beforeinstallpromptevent. Save it. Show a custom "Install" button (Mini-CTA). When clicked, callprompt()on the saved event. - iOS (Safari): No
beforeinstallprompt. Must show a custom UI instructing "Tap Share -> Add to Home Screen". - Desktop (Chrome/Edge): Similar to Android, but often the button is in the omnibox. Best practice is still to show a site-owned UI (banner or button) to trigger the flow.
- Android: Can capture the
-
Phase 3: Analytics Instrumentation
- I need a consistent naming convention (e.g.,
pwa_funnel_step). - Steps:
view->click->native_prompt_view->native_prompt_accept/native_prompt_dismiss.
- I need a consistent naming convention (e.g.,
-
Phase 4: The Code Structure
- I'll use a component-based mental model (like React) for clarity, but keep the logic generic enough.
- State variables:
canInstall(Android/Desktop),isIOS(Safari check). - Effect: Listen for
beforeinstallprompt.
-
Phase 5: Designing the "Mini-CTA" vs. "Share Sheet Guide"
- Android: A sticky footer or floating action button (FAB) works well. A "Mini-CTA" usually refers to a small bar at the bottom.
- iOS: A modal overlay with an arrow pointing to the Share icon is standard UX.
Refining the Analytics: Just "tracking" isn't enough. We need to track why and where.
pwa_install_source: Was it the header button, the floating banner, or the menu item?pwa_platform: android, ios, desktop.
Self-Correction/Refinement during drafting:
- Correction: Initially, I might just say "Show banner." But Android specifically asks for the "mini-info-bar" or a custom UI. Google prefers custom UI. I should focus on the Custom Install Button approach which triggers the native modal, rather than the automatic mini-info-bar (which Chrome sometimes suppresses if the user dismisses similar banners elsewhere).
- iOS Nuance: iOS only supports manual installation. The "Share Sheet" is the mechanism. I need to provide a visual guide (sprite) showing the 'Up' arrow and 'Add to Home Screen'.
Final Output Structure:
- Funnel Architecture: Diagram/Flow logic.
- Analytics Schema: The Data Dictionary.
- Platform-Specific UI Designs:
- Android (Auto-prompt vs Manual trigger).
- iOS (The "How-to" Modal).
- Desktop (Address bar vs App UI).
- Implementation Logic (Pseudocode/JS): The glue code.
- Optimization Tips: A/B testing, timing.
Let's write this out. This design outlines a comprehensive PWA install funnel. It moves beyond simple "pop-ups" and creates a guided flow tailored to the specific constraints of Android, iOS, and Desktop environments, wired with detailed event tracking.
1. The Strategy & Platform Logic
To optimize conversion, we must handle the three distinct installation mechanisms:
- Android (The Automated Route): Utilizes the native
beforeinstallpromptevent. We will capture this event and surface a custom, high-contrast Mini-CTA (sticky footer) to encourage the user to trigger the native bottom-sheet. - iOS (The Manual Route): Safari on iOS does not support the native installation API. We must detect iOS Safari and display a "Coach Mark" ( instructional overlay) guiding the user to use the "Share Sheet" -> "Add to Home Screen."
- Desktop (The Standard Route): Similar to Android, but the UI often allows for more screen real estate. We will use a centered modal or a prominent App Bar button.
2. Analytics Instrumentation Schema
Before writing code, we define the data structure. You cannot optimize what you do not measure. We will use a generic
trackEventfunction.Event Taxonomy:
Event Name Trigger Properties pwa_prompt_shownFunnel UI appears on screen platform(android/ios/desktop),trigger(auto/manual)pwa_cta_clickedUser clicks our custom install button platform,ui_location(sticky_footer/modal)pwa_native_dialog_acceptedUser clicks "Add" on native prompt (Android/Desktop) platformpwa_native_dialog_dismissedUser clicks "Cancel" on native prompt platformpwa_ios_coachmark_viewediOS instruction modal viewed platform: 'ios'pwa_install_successApp launched in standalone mode platform
3. Technical Implementation
Here is the implementation logic using modern ES Modules structure.
A. State Management & Detection
First, we need to know the platform and if the browser allows us to trigger the install.
// pwa-install-manager.js let deferredPrompt = null; // Stores the native BeforeInstallPromptEvent const platform = getPlatform(); // Analytics Stub const trackEvent = (eventName, payload = {}) => { console.log(`[Analytics] ${eventName}`, payload); // Integration: window.dataLayer.push({ event: eventName, ...payload }) }; // Platform Detection Utility function getPlatform() { const ua = navigator.userAgent; if (/android/i.test(ua)) return 'android'; if (/iPad|iPhone|iPod/.test(ua) || (ua.includes("Mac") && "ontouchend" in document)) return 'ios'; return 'desktop'; } // 1. Capture the Native Prompt Event (Android/Desktop) window.addEventListener('beforeinstallprompt', (e) => { e.preventDefault(); deferredPrompt = e; // Only show UI if we have the native capability showInstallFunnel(); });B. The UI Components
We separate the UI into the Sticky Mini-CTA (Android/Desktop) and the iOS Coachmark.
// ui-components.js function showInstallFunnel() { // Check if already installed or dismissed recently if (window.matchMedia('(display-mode: standalone)').matches) return; if (platform === 'ios') { createIOSCoachmark(); } else if (platform === 'android' || platform === 'desktop') { createMiniCTA(); } } /* --- ANDROID/DESKTOP: Sticky Mini-CTA --- */ function createMiniCTA() { const container = document.createElement('div'); container.id = 'pwa-mini-cta'; container.innerHTML = ` <div class="pwa-banner"> <div class="pwa-content"> <img src="/icons/icon-64.png" alt="App Icon" class="pwa-icon"> <div class="pwa-text"> <strong>Install App</strong> <span>Add to home screen for quick access</span> </div> </div> <button id="pwa-install-btn" class="pwa-btn-primary">Install</button> <button id="pwa-dismiss-btn" class="pwa-btn-close">×</button> </div> `; document.body.appendChild(container); trackEvent('pwa_prompt_shown', { platform, type: 'mini_cta' }); // Button Handlers document.getElementById('pwa-install-btn').addEventListener('click', installPWA); document.getElementById('pwa-dismiss-btn').addEventListener('click', dismissPWA); } /* --- iOS: Visual Coachmark --- */ function createIOSCoachmark() { // Logic to determine if we should show (e.g., user engagement score > 10) const container = document.createElement('div'); container.id = 'pwa-ios-modal'; container.innerHTML = ` <div class="ios-backdrop"></div> <div class="ios-modal"> <h3>Install this App</h3> <p>Install this application on your home screen for a better experience.</p> <div class="ios-steps"> <div class="step"> <div class="action-icon">Share</div> <img src="/svg/ios-share-icon.svg" alt="Tap Share"> <span>1. Tap the Share button</span> </div> <div class="step"> <div class="action-icon">Add</div> <img src="/svg/ios-add-icon.svg" alt="Add to Homescreen"> <span>2. Tap "Add to Home Screen"</span> </div> </div> <button id="ios-close">Got it</button> </div> `; document.body.appendChild(container); trackEvent('pwa_prompt_shown', { platform: 'ios', type: 'coachmark' }); document.getElementById('ios-close').addEventListener('click', () => { document.getElementById('pwa-ios-modal').remove(); }); }C. The Action Logic (The Funnel)
This handles the interaction between your custom UI and the browser's native API.
// core-logic.js async function installPWA() { if (!deferredPrompt) return; trackEvent('pwa_cta_clicked', { platform }); // 1. Show the Native Prompt deferredPrompt.prompt(); // 2. Wait for the user's response const { outcome } = await deferredPrompt.userChoice; // 3. Analytics based on outcome if (outcome === 'accepted') { trackEvent('pwa_native_dialog_accepted', { platform }); // UI usually auto-dismisses as app opens, but hide manually just in case document.getElementById('pwa-mini-cta')?.remove(); } else { trackEvent('pwa_native_dialog_dismissed', { platform }); } // 4. Clear the deferred prompt deferredPrompt = null; } function dismissPWA() { trackEvent('pwa_prompt_dismissed', { platform }); document.getElementById('pwa-mini-cta')?.remove(); // Optional: Set localStorage to not show again for X days localStorage.setItem('pwa-dismiss-date', Date.now()); } // Track successful installation (runs on app load) window.addEventListener('appinstalled', () => { trackEvent('pwa_install_success', { platform }); deferredPrompt = null; });4. CSS Styling (Optimized for Thumbs and Mice)
We need CSS that looks native on mobile but clean on desktop.
/* styles.css */ /* ANDROID/DESKTOP STICKY FOOTER */ .pwa-banner { position: fixed; bottom: 0; left: 0; right: 0; background: white; padding: 12px 16px; box-shadow: 0 -2px 10px rgba(0,0,0,0.15); display: flex; align-items: center; justify-content: space-between; z-index: 9999; border-top: 1px solid #eee; animation: slideUp 0.3s ease-out; } .pwa-content { display: flex; align-items: center; gap: 12px; } .pwa-text { display: flex; flex-direction: column; font-size: 14px; } .pwa-btn-primary { background: #1a73e8; color: white; border: none; padding: 10px 20px; border-radius: 4px; font-weight: 600; } /* iOS MODAL */ .ios-modal { position: fixed; bottom: 20%; left: 50%; transform: translateX(-50%); width: 90%; max-width: 400px; background: white; border-radius: 12px; padding: 24px; z-index: 10000; text-align: center; box-shadow: 0 4px 20px rgba(0,0,0,0.2); } .ios-backdrop { position: fixed; inset: 0; background: rgba(0,0,0,0.4); z-index: 9999; } /* DESKTOP OVERRIDES */ @media (min-width: 1024px) { .pwa-banner { /* On desktop, put it in the corner or top header */ bottom: 20px; right: 20px; left: auto; border-radius: 8px; width: 320px; } } @keyframes slideUp { from { transform: translateY(100%); } to { transform: translateY(0); } }5. Funnel Optimization & Best Practices
- The "Value" Trigger: Do not show the
showInstallFunnel()immediately on page load.- Optimization: Use a "Heuristic Trigger". Only show the prompt after the user has visited 2 pages or spent 30 seconds on the site. This dramatically increases the conversion rate (User Intent).
- Android Mini-CTA vs Native Infobar:
- Chrome on Android may show its own system "mini-infobar" automatically.
- Design Choice: You cannot prevent the system infobar easily without harming SEO/UX, but your custom Mini-CTA provides a consistent design. If the user dismisses yours, use the
dismissPWAlogic to avoid nagging them.
- iOS Friction:
- Since iOS requires manual steps, the UI needs to be extremely clear. Use SVG icons that match the specific iOS version (e.g., the "Share" icon changed in recent versions).
- Service Worker Requirement:
- Remember that
beforeinstallprompt(Android/Desktop) will not fire unless you have a validmanifest.jsonand a registeredservice-worker.js.
- Remember that
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.