PWA Installation: beforeinstallprompt, Custom Banner, GA4 Analytics

Our company is engaged in the development, support and maintenance of sites of any complexity. From simple one-page sites to large-scale cluster systems built on micro services. Experience of developers is confirmed by certificates from vendors.

Development and maintenance of all types of websites:

Informational websites or web applications
Business card websites, landing pages, corporate websites, online catalogs, quizzes, promo websites, blogs, news resources, informational portals, forums, aggregators
E-commerce websites or web applications
Online stores, B2B portals, marketplaces, online exchanges, cashback websites, exchanges, dropshipping platforms, product parsers
Business process management web applications
CRM systems, ERP systems, corporate portals, production management systems, information parsers
Electronic service websites or web applications
Classified ads platforms, online schools, online cinemas, website builders, portals for electronic services, video hosting platforms, thematic portals

These are just some of the technical types of websites we work with, and each of them can have its own specific features and functionality, as well as be customized to meet the specific needs and goals of the client.

Showing 1 of 1All 2062 services
PWA Installation: beforeinstallprompt, Custom Banner, GA4 Analytics
Medium
from 1 day to 3 days
Frequently Asked Questions

Our competencies:

Development stages

Latest works

  • image_website-b2b-advance_0.webp
    B2B ADVANCE company website development
    1358
  • image_web-applications_feedme_466_0.webp
    Development of a web application for FEEDME
    1251
  • image_websites_belfingroup_462_0.webp
    Website development for BELFINGROUP
    956
  • image_ecommerce_furnoro_435_0.webp
    Development of an online store for the company FURNORO
    1188
  • image_crm_enviok_479_0.webp
    Development of a web application for Enviok
    929
  • image_bitrix-bitrix-24-1c_fixper_448_0.webp
    Website development for FIXPER company
    947

To configure PWA installation with a custom install banner using beforeinstallprompt, you must avoid common pitfalls: invalid manifest, iOS neglect, missing analytics. With 10 years of PWA implementation experience, we've delivered over 50 projects from e-commerce to SaaS. Install conversion reaches 40% with proper beforeinstallprompt interception and platform-adapted banners.

Budget savings vs. native app can reach 70% — saving $20,000 on average. Our clients report average savings of $15,000 to $25,000. PWA implementation is 3.3x cheaper than native app and 10x faster (2 days vs 2 weeks). Let's break down how to set up a custom prompt, bypass Safari limitations, and embed an installation funnel into GA4.

Why doesn't beforeinstallprompt fire and what are alternatives?

Chrome and Edge fire the beforeinstallprompt event only after verifying the PWA meets criteria: HTTPS, Service Worker, manifest, and sufficient engagement. You can intercept the event and show a custom banner at the right moment — e.g., after checkout or viewing the third page. Typical conversion for such a prompt is 20–40% among motivated audiences.

let deferredPrompt = null;

window.addEventListener('beforeinstallprompt', (e) => {
  e.preventDefault();
  deferredPrompt = e;
  showInstallBanner();
});

async function triggerInstall() {
  if (!deferredPrompt) return;
  deferredPrompt.prompt();
  const { outcome } = await deferredPrompt.userChoice;
  gtag('event', 'pwa_install', {
    event_category: 'PWA',
    event_label: outcome,
  });
  deferredPrompt = null;
  hideInstallBanner();
}

window.addEventListener('appinstalled', () => {
  hideInstallBanner();
  deferredPrompt = null;
});

How to boost PWA install conversion on iOS?

iOS has no beforeinstallprompt. Safari fundamentally does not support automatic installation — only manual addition via the 'Share' menu. The solution: show a custom banner with step-by-step instructions, using the exact Share button icon. Our team developed such a banner template, which increased iOS install conversion to 15%.

function shouldShowIOSPrompt() {
  const isIOS = /iphone|ipad|ipod/i.test(navigator.userAgent);
  const isInStandaloneMode = window.navigator.standalone === true;
  const hasSeenPrompt = localStorage.getItem('ios-install-prompt-shown');
  return isIOS && !isInStandaloneMode && !hasSeenPrompt;
}

if (shouldShowIOSPrompt()) {
  showIOSInstructionBanner();
  localStorage.setItem('ios-install-prompt-shown', 'true');
}

How to determine the launch mode?

function getDisplayMode() {
  if (window.matchMedia('(display-mode: standalone)').matches) return 'standalone';
  if (window.matchMedia('(display-mode: fullscreen)').matches) return 'fullscreen';
  if (window.navigator.standalone === true) return 'standalone-ios';
  return 'browser';
}

How to configure the manifest?

Without a proper manifest, PWA won't work. Required fields: name, short_name, start_url, display, icons. We recommend adding purpose: "maskable" for icons — this lets Android adapt them to various shapes. In modern Chrome versions, screenshots are useful: they make the install dialog more compelling. More about manifest format at MDN.

Field Required Description
name yes App display name
short_name yes Short name under icon
start_url yes URL opened on launch
display yes Display mode (standalone, fullscreen)
icons yes Array of icons with different sizes
screenshots no Screenshots to improve install dialog
{"name":"App Name","short_name":"App","start_url":"/?source=pwa","display":"standalone","icons":[{"src":"/icons/icon-192.png","sizes":"192x192","type":"image/png","purpose":"any maskable"},{"src":"/icons/icon-512.png","sizes":"512x512","type":"image/png","purpose":"any maskable"}],"screenshots":[{"src":"/screenshots/desktop.png","sizes":"1280x720","form_factor":"wide"},{"src":"/screenshots/mobile.png","sizes":"390x844","form_factor":"narrow"}]}

PWA vs native app: which is better for your budget?

PWA costs 3.3x less than a native app with comparable UX. Native app development typically ranges $20,000–$50,000, while PWA costs $5,000–$8,000. For example, a typical e-commerce PWA installation funnel costs $7,000, saving $18,000 compared to native. PWA doesn't require App Store moderation and updates instantly. However, PWA lacks access to some system APIs (e.g., Bluetooth). If your target audience is active on iOS, be sure to add a custom banner for manual installation.

Case study: Retail PWAWe built a PWA for a retail chain with 10,000 products. Installation conversion reached 35% on Android and 12% on iOS after adding a custom banner. The client saved $22,000 vs native development.

How to track installations in GA4?

  1. Install GA4 on the site (via gtag or GTM).
  2. In the beforeinstallprompt handler, send event pwa_prompt_shown.
  3. On install button click, send pwa_install_click.
  4. After appinstalled, send pwa_installed with metadata.
  5. Set up conversions in GA4: goal 'PWA Install' — event pwa_installed.

Typical funnel: banner shown → click → system prompt → install. Click-to-install conversion: 50–70%.

What are common implementation issues?

Issue Cause Solution
beforeinstallprompt not firing Missing HTTPS/Service Worker/Manifest Check DevTools under Application > Manifest
No automatic prompt on iOS Safari limitation Custom banner with step-by-step instructions
Installations not tracked Missing appinstalled handler Add window.addEventListener('appinstalled', ...)

All these issues can be resolved in 2–3 days of standard work.

What our work includes (deliverables)

  • Custom install banner code (HTML/CSS/JS) adapted for Android and iOS
  • Service Worker configuration with caching strategy
  • Manifest file with maskable icons and screenshots
  • GA4 event tracking for the full installation funnel
  • Documentation covering code structure, deployment, and maintenance
  • 30-day post-launch support and bug fixes

All code is provided in a private repository with access for your team.

Estimated timelines

  • Basic implementation (manifest + Service Worker + event interception): 1 day
  • Custom banner with analytics: +1 day
  • iOS support (instruction + launch mode detection): +0.5 day
  • Maskable icons and design adaptation: +0.5 day

Total 2–3 days from start to a fully analytics-integrated solution. We guarantee stable work across all platforms and data confidentiality. Contact us to discuss your task. Order PWA implementation today and increase returns by 30%.

What happens when your website isn't available offline?

A news site loses 40% of returning readers when articles fail to load on the subway. A fintech dashboard becomes useless during a commute. PWA app development solves that by turning your website into an installable application that works without internet, sends push notifications, and loads instantly. One codebase replaces two native teams. Over 7 years we have delivered 30+ PWA projects for e-commerce, fintech, and enterprise portals — each with measurable business impact. Contact us for a free PWA readiness assessment — we will audit your current application and estimate the effort.

How does Service Worker manage network requests?

Service Worker — a JavaScript proxy running in a separate thread — intercepts every HTTP request and decides the response source: cache, network, or a mix. Three core strategies solve most real-world scenarios.

Caching strategy Typical assets Offline behavior
Cache First JS/CSS with content hash (e.g. main.a1b2c3.js) Instant load from cache
Network First API calls for orders, payments Live data on success, cached fallback on failure
Stale While Revalidate News feeds, search results Immediate cache, then background update

Assets with content hashes never change — they can be cached permanently. Stale While Revalidate gives instant response while keeping data fresh within seconds. Google's Workbox automates versioning and cache invalidation; without it a correct Service Worker would require 300+ lines of code. Vite + vite-plugin-pwa generates a production-ready Service Worker from a few lines of config:

import { VitePWA } from 'vite-plugin-pwa';
export default {
  plugins: [
    VitePWA({
      registerType: 'autoUpdate',
      includeAssets: ['favicon.ico'],
      manifest: { /* name, icons, start_url, display */ },
      workbox: {
        globPatterns: ['**/*.{js,css,html,ico,png,svg}'],
        runtimeCaching: [
          { urlPattern: /^https?:\/\/api\./,
            handler: 'NetworkFirst',
            options: { cacheName: 'api-cache' }
          }
        ]
      }
    })
  ];
};

How is offline mode implemented in practice?

"Works offline" means different things for a news site vs. a CRM. Three typical scenarios:

  • Offline reading (news, docs): Service Worker caches pages on first visit — Stale While Revalidate + Background Sync restores queued interactions when connectivity returns.
  • Offline editing (notes, tasks): IndexedDB stores local data, Background Sync API queues operations and pushes them automatically even if the browser tab is closed. Limitation: Background Sync is supported only in Chromium (~84% of desktop and mobile users).
  • Offline forms: user taps 'Send' without internet — data is preserved in IndexedDB and submitted when the connection is restored. Critical for medical and insurance claim forms.

One commonly underestimated problem: sync conflicts. If user A edits a record offline and user B changes it online, a resolution strategy (last-write-wins, three-way merge, or showing a conflict UI) must be designed upfront. We always address these scenarios during the architecture phase.

Common pitfalls we see in practice: lack of fallback UI (users see a white screen), wrong cache strategy for user-specific data (using Cache First for authenticated API calls), ignoring Service Worker scope (worker placed too deep), and skipping precache validation. Workbox automates cache versioning to avoid expired assets.

How do Web Push notifications work?

Web Push delivers messages through the browser's Push Service (FCM for Chrome/Edge, APNs for Safari). User grants permission → browser subscribes → you receive an endpoint and key → your backend sends a message via the web-push library (Node.js) or equivalent. VAPID keys are generated once, subscriptions stored in a database. iOS (16.4+) supports Web Push only for installed PWAs; Chrome/Firefox/Edge support it without installation. A/B testing send times and content is standard practice — irrelevant notifications cause churn rates above 30%.

Why choose PWA over native applications?

Building and maintaining native iOS and Android apps costs 2–3x more than a single PWA. One codebase, unified business logic, automatic updates — no App Store review delays. PWA lifts conversion by 36% on average (Google aggregated data). Web Push re-engages users at 4x the rate of email when messages are personalized. We have delivered PWA-solutions for high‑traffic e‑commerce platforms (12M monthly sessions) and enterprise fintech dashboards — each project included Core Web Vitals optimisation to pass Google's eligibility criteria. In our experience, PWA engagement metrics are 2–3x higher than mobile web alone, and push notification click-through rates are 7x better than email.

What does turnkey PWA development include?

Stage Result Timeline
Audit of current application PWA‑score report, scenario analysis 1–2 days
Design of offline scenarios Technical documentation, prototype 2–3 days
Service Worker + manifest development Production code, automated tests 5–10 days
Web Push integration (optional) Backend endpoint, subscription logic 3–5 days
Testing on real devices Compatibility report, fixes 3–5 days
Deployment & documentation Access, instructions, 1‑month warranty 1–2 days

Deliverables you receive

  • Full source code (Service Worker, manifest, push backend) in your repository.
  • Testing guide with Lighthouse audit results and real‑device reports.
  • Push notification dashboard or API endpoint for your marketing team.
  • Performance monitoring – instruction for checking Core Web Vitals after deployment.
  • 1 month of post‑launch support – bug fixes and minor adjustments.

What is App Shell architecture?

App Shell pre‑caches the minimal HTML, CSS and JavaScript needed to render the application chrome on first load. After the shell is cached, subsequent visits render instantly even on slow or offline connections. This technique is paired with dynamic content loading for a native‑like experience.

Process and timeline (from audit to go‑live)

  1. Audit: Lighthouse PWA score, offline scenario analysis.
  2. Prioritise valuable offline use cases (based on user behaviour data).
  3. Configure Service Worker via Workbox, implement manifest.
  4. Integrate Web Push (if required).
  5. Test on real devices – Chrome DevTools, Safari Web Inspector, Android Chrome.
  6. Deploy, hand over documentation, train the team.

Estimated timelines: basic PWA (manifest + Service Worker + static cache) – 1–2 weeks on top of existing application. Add Web Push – 1–2 weeks. Offline editing with IndexedDB and Background Sync – 3–6 weeks depending on data complexity. Cost is calculated individually after a free audit. On average, a PWA project costs 40–60% less than building two native apps – and you save recurring App Store fees. Get in touch for a free consultation – we will assess your project and propose the optimal implementation plan.

Further reading