GoogleChromeLabs / bubblewrap

Bubblewrap is a Command Line Interface (CLI) that helps developers to create a Project for an Android application that launches an existing Progressive Web App (PWAs) using a Trusted Web Activity.
Apache License 2.0
2.29k stars 152 forks source link

Add Suffix to User-Agent or Referrer with the version of the TWA #823

Open ghnp5 opened 11 months ago

ghnp5 commented 11 months ago

At the moment, the only way I am aware of that we can pass the version of the TWA app I have, is through the Start URL, adding something like /?twa=123

However, if a user accesses the app through opening a Push Notificaiton, or a link from another app/browser, that opens a specific page or so, then the version will not be passed anywhere.

URL: /specific-page Referrer: android-app://com.mytwa User-Agent: Mozilla/5.0 (Linux; Android 10; K) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/116.0.0.0 Mobile Safari/537.36

It would be nice if we could add a suffix to the current User-Agent, so we could add the version, e.g.:

User-Agent: Mozilla/5.0 (Linux; Android 10; K) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/116.0.0.0 Mobile Safari/537.36 TWA/123

Or to the Referrer:

Referrer: android-app://com.mytwa+v123

So we could have a reliable way of knowing what version the user is on.

Thank you!

jalalaghazadeh commented 5 months ago

same as above I need to add query-params to launcherUrl (like google-ad-id and referrer id) but the is an redundent '/' (https://app.example.com/?gps_adid=null&referrer=null).

Any update on this one?