- Progressive Web Application Development by Example
- Chris Love
- 247字
- 2021-08-05 10:33:21
Tracking homescreen installs
Once the homescreen install prompt displays, the user can choose to add the PWA to their homescreen, or ignore the prompt. Businesses should track and measure everything possible to make better decisions. Knowing how many homescreen installs there have been and what rate customers install their PWA provides insight into their marketing and technology investments.
Chrome supports the beforeinstallprompt event, which can be used to track this activity. You can add a handler to this event and log each user's choice:
window.addEventListener('beforeinstallprompt', function(event) { event.userChoice.then(function(result) { if(result.outcome == 'dismissed') { // They dismissed, send to analytics }else { // User accepted! Send to analytics } }); });
You can POST the user's choice to your analytics system. This could be a custom API to your internal analytics or even tied to your third-party service, like Google Analytics.
The beforeinstallprompt is part of the web manifest specification, but at the time of writing this book, it is only supported by Chrome. Hopefully, other browsers will add support soon.
Browsers that don't support beforeinstallprompt can also provide feedback. The web manifest's start_url can be set either to a special start URL, or a custom querystring value appended to the default URL. You will need to add logic to your log analyzer to track this behavior. Besides just knowing how many homescreen installs you have, you can also track how many times users have launched your PWA as opposed to those who have not installed your PWA.
- CorelDRAW X6 中文版圖形設計實戰從入門到精通
- 物聯網短距離無線通信技術應用與開發
- Hands-On Chatbot Development with Alexa Skills and Amazon Lex
- 中國互聯網發展報告2018
- 大型企業微服務架構實踐與運營
- 網絡空間全球治理觀察
- 區塊鏈社區運營手冊
- Cisco無線局域網配置基礎
- 黑客與反黑工具使用詳解
- 趣話通信:6G的前世、今生和未來
- INSTANT Social Media Marketing with HootSuite
- 智慧的物聯網:感知中國和世界的技術
- Learning Dart
- Learning IoT with Particle Photon and Electron
- 5G低功耗蜂窩物聯網開發與應用