Script needs to run standalone in browser ( no need for an Apache or Nginx server running behind it)
URL structure will be the following:
[login to view URL]
The parameter provided in url would not matter and should not have any impact in redirect. Redirect would either send to App Store or Google Play Store depending on platform from device making the request.