Progressive Web App(PWA)이 있으면 스마트 배너를 어떻게 쓸지 고민이 생겨요. 보통 스마트 배너는 네이티브 앱 설치를 유도해요. 그런데 PWA도 있다면 뭘 홍보해야 할까요? 플랫폼 기능을 더 깊이 쓸 수 있는 네이티브 앱일까요, 가볍게 설치할 수 있는 PWA일까요? 둘 다일까요? 아니면 (사용자가 이미 PWA를 쓰고 있다면) 둘 다 아닐까요?
답은 PWA만 있는지, 네이티브 앱만 있는지, 둘 다 있는지에 따라 달라요. 경우마다 배너 전략도 달라져요. 이 가이드에서는 각 경우에 스마트 배너를 어떻게 다루면 되는지 설명해요. 스마트 배너 기본 설정은 스마트 배너 가이드를 참고하세요. PWA와 App Links를 함께 쓰는 방법은 다음 문서를 참고하세요: PWA용 App Links.
모바일 기기에서 배너가 어떻게 보이는지 보여 주는 실시간 배너 미리보기.
시나리오 1: 네이티브 앱만 있는 경우(PWA 없음)
가장 일반적인 스마트 배너 사용 사례예요. iOS와 Android 네이티브 앱이 있고, 웹사이트는 일반 웹 페이지예요. 이 경우 스마트 배너는 네이티브 앱을 홍보해요:
const bannerConfig = {
ios: { appId: "id123456789", storeUrl: "https://apps.apple.com/app/id123456789" },
android: { packageName: "com.example.app", storeUrl: "https://play.google.com/store/apps/details?id=com.example.app" },
message: "Get the app for a better experience",
cta: "Install",
};
PWA를 신경 쓸 필요가 없어요. 배너는 항상 네이티브 앱을 홍보해요.
시나리오 2: PWA만 있는 경우(네이티브 앱 없음)
네이티브 앱 없이 PWA만 있다면 스마트 배너로 PWA 설치("홈 화면에 추가")를 유도하면 돼요:
웹 앱 설치 프롬프트 활용하기
브라우저는 PWA용 기본 설치 프롬프트를 beforeinstallprompt 이벤트로 제공해요. 스마트 배너에서 이 프롬프트를 띄울 수 있어요:
let deferredPrompt;
window.addEventListener('beforeinstallprompt', (e) => {
// 브라우저 기본 설치 프롬프트 막기
e.preventDefault();
deferredPrompt = e;
// 커스텀 스마트 배너 표시
showPWAInstallBanner();
});
function showPWAInstallBanner() {
const banner = createBanner({
message: "Install our app for offline access",
cta: "Add to Home Screen",
onCtaClick: async () => {
if (deferredPrompt) {
deferredPrompt.prompt();
const result = await deferredPrompt.userChoice;
if (result.outcome === 'accepted') {
analytics.track('pwa_installed');
}
deferredPrompt = null;
hideBanner();
}
},
});
document.body.appendChild(banner);
}
PWA 배너 고려 사항
- 설치 가능할 때만 표시하세요. intent URL의
beforeinstallprompt이벤트는 PWA가 설치 가능 조건을 충족할 때만 발생해요. 이벤트가 발생하지 않았다면 PWA 설치 배너를 띄우지 마세요. - 이미 설치한 사용자에게는 표시하지 마세요. 디스플레이 모드를 확인하면 PWA가 이미 설치됐는지 알 수 있어요:
function isPWAInstalled() {
return window.matchMedia('(display-mode: standalone)').matches ||
window.matchMedia('(display-mode: fullscreen)').matches ||
window.navigator.standalone === true; // iOS Safari
}
- iOS Safari에서 지원하지 않는 이벤트:
beforeinstallprompt. iOS에서는 코드로 설치 프롬프트를 띄울 수 없어요. 대신 "공유 버튼을 탭한 다음 '홈 화면에 추가'를 선택하세요." 같은 안내를 보여 주세요.
시나리오 3: 네이티브 앱과 PWA가 모두 있는 경우
가장 까다로운 경우예요. PWA와 네이티브 앱을 둘 다 제공하니까 배너에서 어느 쪽을 홍보할지 정해야 해요.
판단 로직
function chooseBannerType() {
const platform = detectPlatform();
// If the native app is installed, don't show any banner
if (isNativeAppInstalled()) return null;
// If the PWA is installed, don't show any banner
if (isPWAInstalled()) return null;
// Promote native app on platforms where it's available
if (platform === 'ios' && hasNativeIOSApp) return 'native';
if (platform === 'android' && hasNativeAndroidApp) return 'native';
// On desktop or unsupported platforms, promote PWA
if (platform === 'desktop' && hasPWA) return 'pwa';
// Fallback: promote native if available, otherwise PWA
return hasNativeApp ? 'native' : 'pwa';
}
PWA보다 네이티브 앱을 권해야 할 때
네이티브 앱을 홍보할 때:
- PWA로는 안 되는 기능을 네이티브 앱이 제공할 때(iOS 푸시 알림, Bluetooth, NFC, 위젯, Siri/Google Assistant 연동)
- 사용 사례상 네이티브 앱의 성능이 훨씬 좋을 때(게임, 동영상 편집, 카메라 기능)
- 검색 노출을 위해 Play Store / App Store에 앱을 올리고 싶을 때
네이티브 앱보다 PWA를 권해야 할 때
PWA를 홍보할 때:
- 사용자가 데스크톱 브라우저를 쓸 때(네이티브 모바일 앱과 관계없는 상황)
- 사용자의 플랫폼용 네이티브 앱이 없을 때
- 설치 과정을 간단하게 하고 싶을 때(앱 스토어 다운로드보다 PWA 설치가 빨라요)
- 이 사용자에게 필요한 기능이라면 PWA로도 네이티브 앱과 똑같이 쓸 수 있을 때
두 가지 옵션 모두 보여 주기
경우에 따라 둘 다 제시할 수도 있어요:
<div class="smart-banner smart-banner--dual">
<div class="smart-banner__content">
<img src="/app-icon.png" class="smart-banner__icon" alt="앱" />
<p class="smart-banner__message">앱 받기</p>
</div>
<div class="smart-banner__actions">
<a href="https://apps.apple.com/..." class="smart-banner__cta smart-banner__cta--native">
App Store
</a>
<button class="smart-banner__cta smart-banner__cta--pwa" onclick="installPWA()">
홈 화면에 추가
</button>
</div>
</div>
선택지가 많으면 사용자가 고르기 어려워해서 잘 쓰지 않는 방법이에요. 보통은 하나를 골라 홍보하세요.
사용자 상황 파악하기
네이티브 앱이 설치되어 있나요?
웹에서 네이티브 앱 설치 여부를 모든 플랫폼에서 안정적으로 확인하는 방법은 없어요. 쓸 수 있는 방법은 다음과 같아요:
커스텀 스킴 감지(제한적):
// 신뢰성이 낮고 브라우저에서 차단되는 경우가 많은 방식이에요
function checkNativeApp(customScheme) {
const start = Date.now();
window.location.href = `${customScheme}://check`;
setTimeout(() => {
if (Date.now() - start < 2000) {
// 앱이 설치되지 않았을 가능성이 높음 (페이지가 이동하지 않음)
showBanner();
}
}, 1500);
}
쿠키 기반 감지: 네이티브 앱이 공유 웹뷰나 SDK를 통해 쿠키를 설정한다면, 웹 페이지에서 그 쿠키를 확인할 수 있어요:
function isNativeAppInstalled() {
return document.cookie.includes('native_app_installed=true');
}
Tolinku 감지: Tolinku SDK 는 리디렉션 체인으로 앱 설치 여부를 감지해요. 앱이 설치되어 있고 링크를 처리하면 사용자는 웹 폴백 페이지로 가지 않아요.
PWA가 설치되어 있나요?
function isPWAInstalled() {
// Check display mode
if (window.matchMedia('(display-mode: standalone)').matches) return true;
// iOS Safari standalone mode
if (window.navigator.standalone === true) return true;
// Check if the install prompt is available (if not, PWA might already be installed)
// Note: this is not conclusive; the prompt may not fire for other reasons
return false;
}
TWA 안에서 실행 중인가요?
네이티브 앱이 PWA를 감싼 Trusted Web Activity(TWA)라면:
function isRunningInTWA() {
return document.referrer.includes('android-app://');
}
TWA 안에서는 설치 배너를 띄우지 마세요. 사용자가 이미 앱 안에 있으니까요.
서비스 워커 관련 고려 사항
PWA의 서비스 워커가 페이지를 캐시한다면, 스마트 배너 설정은 과하게 캐시되지 않도록 해 주세요:
// 서비스 워커: 배너 설정은 캐시하지 않음
self.addEventListener('fetch', (event) => {
const url = new URL(event.request.url);
// 배너 설정은 항상 네트워크에서 가져옴
if (url.pathname.includes('/api/banner') || url.pathname.includes('/banner-config')) {
event.respondWith(fetch(event.request));
return;
}
// 나머지 리소스는 평소대로 캐시
event.respondWith(
caches.match(event.request).then(cached => cached || fetch(event.request))
);
});
배너 설정이 캐시되어 있으면 캐시가 만료될 때까지 일정 변경과 A/B 테스트가 적용되지 않아요.
PWA용 Tolinku 스마트 배너
Tolinku의 스마트 배너 는 네이티브 앱과 PWA 홍보를 모두 지원해요. SDK가 사용자의 환경(플랫폼, 설치된 앱, 디스플레이 모드)을 감지해서 알맞은 배너를 보여 줘요. 네이티브 앱과 PWA 대상은 여기서 설정하세요: Tolinku 대시보드.
Android에서 PWA와 App Links가 어떻게 함께 동작하는지는 다음 글을 참고하세요: PWA용 App Links. 스마트 배너 가이드 전체는 다음을 참고하세요: 스마트 배너 개요.
딥 링킹 팁을 메일로 받아 보세요
일주일에 한 번만 보내요. 스팸은 없어요.