I agree with the other commenters that this is a pretty simple engineering problem, but I still enjoyed reading about edge cases the author worked to address (they could have taken the easy road with this but tried not to). I forgot that Safari on iPad doesn't specify iPad in user agent headers
11 comments
[ 2.9 ms ] story [ 19.9 ms ] threadTL;DR: it is HTTP redirect based on User-Agent header
Just have a branded link (like https://slyp.app/Slyp or https://slyp.app/SlypBusiness) to the official web page and have the js in that page open the original Playstore/Appstore page.
And yes, we used userAgent for identifying the platform.
If anyone is interested, here is the code