0

I've been following the guidance on google to create a PWA, but I am interested if there are any conventions to communicate with your data server that you are being called by a PWA. Is the easiest thing to add a parameter to the request i.e.

var dataUrl = 'https://query.myapi.com/v1/get?source=pwa';

and then check the source parameter? Or should I add to the request header?

Uwe Keim
  • 39,551
  • 56
  • 175
  • 291
Micromuncher
  • 903
  • 7
  • 19

2 Answers2

0

In your code

if (window.matchMedia('(display-mode: standalone)').matches) {  
    // do things here  
    // set a variable to be used when calling something  
    // e.g. call Google Analytics to track standalone use   
}  

** Assumption made that you are also setting up your app to be added to the users home screen as a shortcut

Mathias
  • 4,243
  • 4
  • 25
  • 34
0

You have to pass in the traffic source to Google Analytics indicating its from PWA. Refer this answer on more details.

Anand
  • 9,672
  • 4
  • 55
  • 75