Reputation: 75
I'm using the
window.addEventListener('beforeinstallprompt', e => {
e.userChoice.then(choiceResult => {
ga('send', 'event', 'A2H', choiceResult.outcome);
alert('AAAAAAAAAAAAAa',choiceResult.outcome)
});
});
but this event not work with event default of pwa, only work with one button custom generating deferredPrompt.prompt();
what i can do?
Upvotes: 4
Views: 2294
Reputation: 1397
I don't have any PWA experience, but I found these two resources that may help.
window.addEventListener('appinstalled', function() {
console.log('Thank you for installing our app!');
});
// or
window.onappinstalled = function() {
console.log('Thank you for installing our app!');
};
I wanted to learn more about PWAs last week and stumbled across this youtube video. It has some good info. It talks about deferring the event object from 'beforeinstallprompt'
so you can use it later in your own "Install" prompt.
Upvotes: 6