• Resolved phaser32

    (@phaser32)


    Hi, I would like to ask you if there is any way to intercept if the user is browsing in pwa mode.
    I did some research online and found these solutions:
    
    window.addEventListener('DOMContentLoaded', () => {
    let displayMode = 'browser tab';
    if (window.matchMedia('(display-mode: standalone)').matches) {
    displayMode = 'standalone';
    }
    // Log launch display mode to analytics
    console.log('DISPLAY_MODE_LAUNCH:', displayMode);
    });
    
    or this:
    
    window.addEventListener('appinstalled', () => {
    // If visible, hide the install promotion
    hideInAppInstallPromotion();
    // Log install to analytics
    console.log('INSTALL: Success');
    });
    
    But none of the above solutions work.
    Without going into too much detail about the goal I'm trying to achieve, I'll try to simplify it like this.
    If the user is viewing the site in PWA mode echo "YOU ARE ON PWA"
    There is a way to achieve this goal.
    I've read all your documentation but haven't found anything about it.
    Thank you for your attention and time dedicated.
Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Author SuperPWA

    (@superpwa)

    Hi, Thank you for reaching out to us. As you said “If the user is viewing the site in PWA mode echo “YOU ARE ON PWA”, Where you need this exactly and where you want to show this in PWA mode? Could you please provide some reference so we can check accordingly.

    Thread Starter phaser32

    (@phaser32)

    Good morning, first of all thanks for the reply. I gave a simple example and it doesn’t matter where the wording “YOU ARE ON PWA” appears, it could be in the footer or in the header. In reality what I’m trying to do is understand how to discriminate a user who views the site in pwa mode from another who is simply viewing it as a site from the browser.
    thx

    Plugin Author SuperPWA

    (@superpwa)

    Hi, please refer to this manual once https://superpwa.com/docs/article/data-analytics-add-on-for-superpwa/ and perform all the steps mentioned. This way you can achieve the desired output. Try this once and let us know if you need any help.

    Thread Starter phaser32

    (@phaser32)

    Good morning, I probably misunderstood the request. We do not need to carry out any traffic analysis, but rather we would need to discriminate against a user who accesses the webapp/PWA from a “normal” browser simply to show or hide some elements.
    Thx for any support
    Warm regards

    Ale

    Plugin Author SuperPWA

    (@superpwa)

    Hi, we were trying to understand your exact goal. The simple answer is that you can use the code you shared because it’s the same code. You can apply the same code approach wherever you need to achieve your goal. Try this out and let us know if you need any help.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘PWA Detector’ is closed to new replies.