question

Ben-4350 avatar image
1 Vote"
Ben-4350 asked MicahEngleEshleman-3170 published

Detect that a PWA has been launched from Microsoft Store

I built a PWA and integrated it in the Microsoft Store (https://www.microsoft.com/store/productId/9P82T7LD9LCK). Now I would like to customize some of its functionalities for MS Store but first I need to detect (in javascript or CSS) that the app has been launched from MS Store (as opposed to launched from a web browser). Can you help me with this?

I also would like to track the app using Google Analytics and for that I need to pass one or several "utm" arguments in the start url. Since I used PWAbuilder.com to build the app packages, I tried to fill the "URL" field of the "Windows Package Options" with the following value: "https://base.finance?utm_source=microsoft_store". However, it does not seem to work: when I open the app from the MS Store, the start url is just "https://base.finance". What else can I do?

not-supported
· 1
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Just wrote a brief article on this:
https://micahjon.com/2021/detect-microsoft-store-pwa/

Edge Chromium will use a custom referrer when loading your start URL when a user first opens your PWA. You can then keep track of this state in SessionStorage.

 document.referrer === 'app-info://platform/microsoft-store';
0 Votes 0 ·

1 Answer

JussiPalo avatar image
0 Votes"
JussiPalo answered

Does anyone have any answer to this? My app is pending because I'd need a way to hide links to other Stores but only when running in MS Store PWA.

5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.