Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add PWA detection analytics event #1211

Open
2 tasks
Tracked by #1197
annarhughes opened this issue Nov 19, 2024 · 0 comments
Open
2 tasks
Tracked by #1197

Add PWA detection analytics event #1211

annarhughes opened this issue Nov 19, 2024 · 0 comments
Labels
complexity: moderate Time needed to do this ticket will be moderate e.g. 1-2 days feature/enhancement New feature or request first-timers-friendly Appropriate for first time contributors. good first issue Good for newcomers priority: soon Should be prioritized soon.
Milestone

Comments

@annarhughes
Copy link
Member

annarhughes commented Nov 19, 2024

Overview

This task is related to PWA epic #1197 . This task involves adding analytics events to be triggered on each app load, sending either WEB_APP_LOADED or PWA_LOADED depending on whether the user is using a PWA or normal web app.

Action Items

  • Add logic to determine if the user is using a PWA or web app - see resources below
  • Send analytics events on app load, WEB_APP_LOADED or PWA_LOADED using our existing logEvent() function - see more about our events in Add PWA analytics events #1208. Include the eventUserData params and an additional browser param with the event, i.e. logEvent(PWA_LOADED, eventUserData)

Resources/Instructions

To test that analytics events are being triggered, check the console log where events should be shown.

Note these resources are guides to general pwa/browser detection, but there may be a better solution for next.js or next-pwa
https://web.dev/learn/pwa/detection
https://stackoverflow.com/questions/41742390/javascript-to-check-if-pwa-or-mobile-web

const isInStandaloneMode = () =>
      (window.matchMedia('(display-mode: standalone)').matches) || (window.navigator.standalone) || document.referrer.includes('android-app://');

 if (isInStandaloneMode()) {
    console.log("webapp is installed")
}
@annarhughes annarhughes added feature/enhancement New feature or request good first issue Good for newcomers complexity: moderate Time needed to do this ticket will be moderate e.g. 1-2 days priority: soon Should be prioritized soon. first-timers-friendly Appropriate for first time contributors. labels Nov 19, 2024
@kyleecodes kyleecodes added this to the 02. Roadmaps milestone Nov 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
complexity: moderate Time needed to do this ticket will be moderate e.g. 1-2 days feature/enhancement New feature or request first-timers-friendly Appropriate for first time contributors. good first issue Good for newcomers priority: soon Should be prioritized soon.
Projects
None yet
Development

No branches or pull requests

2 participants