endlessm / kolibri-explore-plugin

The kolibri plugin to add the custom channel representation
MIT License
2 stars 4 forks source link

Include platform and locale data in Typeform hidden fields #868

Open cassidyjames opened 11 months ago

cassidyjames commented 11 months ago

We often wonder what platform and locale feedback is coming from. It turns out Typeform supports hidden fields with a URL parameter-like hash, so we should be able to include this easily:

https://www.typeform.com/help/a/using-hidden-fields-360052676612/

We may want to include the app version in there while we're at it. I'm not sure if there's other automatic information we'd like to include.

manuq commented 11 months ago

Sounds simple enough! I was wondering about our URL redirects, but all seems fine: If I navigate to https://endlessos.org/key-feedback-es#name=manuel&foo=bar I end up in https://endlessos.typeform.com/to/ohjef1FG#name=manuel&foo=bar

manuq commented 11 months ago

I have a PR with the language and also the Kolibri version + the Endless Key version as displayed in our About modal (eg. "Manatee v6.46.0"). But still draft because I'm missing the platform. I see Kolibri perseus plugin is using navigator.platform but this document says it's outdated? https://developer.mozilla.org/en-US/docs/Web/API/Navigator/platform

manuq commented 11 months ago

After a second thought, we can leave platform as "Unknown" for now. The rest is working. When I try in localhost I am redirected to this URL: https://endlessos.typeform.com/to/ohjef1FG?typeform-source=localhost#language=es-419&platform=Unknown&kolibriVersion=0.16.0b1

manuq commented 11 months ago

Actually, the way to go with platform is to pass "KOLIBRI_PROJECT" to the hidden fields. This is what Kolibri uses for telemetry too. For example we pass "endless-key-android" in the Android app: https://github.com/endlessm/kolibri-installer-android/blob/a575aaeeff7904eb51ee218c90f83ff585aca5f9/src/kolibri_android/kolibri_utils.py#L69

manuq commented 11 months ago

The Windows app is passing 'endless-key-windows' too. https://github.com/endlessm/endless-key-app/blob/951e1555525c71499a8c1b0c044342a5b410c2bc/kolibri-electron/src/index.js#L28

@dylanmccall or @starnight can you confirm if the Flathub app is passing KOLIBRI_PROJECT as the Android and Windows apps? I couldn't find it.

starnight commented 11 months ago

Hmm ... Seems like the "KOLIBRI_PROJECT" environment variable has not been set in the flatpak, nor Flathub.

The _init_kolibri_env() might be a good function to place "KOLIBRI_PROJECT" environment variable.

dbnicholson commented 11 months ago

Merged the flatpak change to set KOLIBRI_PROJECT. Moving back to in progress so it can be consumed in the explore plugin. I don't remember if we use this form on the Endless Key server or not, but that should probably set KOLIBRI_PROJECT, too.

manuq commented 11 months ago

Merged the flatpak change to set KOLIBRI_PROJECT. Moving back to in progress so it can be consumed in the explore plugin.

This is actually still ready for review: https://github.com/endlessm/kolibri-explore-plugin/pull/869