OneKey-Network / OneKey-implementation

2 stars 1 forks source link

More open user agent detection #140

Open OlivierChirouze opened 2 years ago

OlivierChirouze commented 2 years ago

Today we detect the current user agent by using https://www.npmjs.com/package/detect-browser Then if user agent is detected to be Safari we immediately consider that 3PC are not supported.

@jwros suggested having a more open approach with an interface that allows publishers to provide their own mechanism of UA detection.

James, can you please elaborate or provide PR with a suggested fix?

Thanks

jwrosewell commented 2 years ago

User agent detection is currently used to make a high level assessment concerning the browsers support for 3PC. This is done using a library to apply regular expressions to the User-Agent value to determine the browser vendor. These libraries take up space and different consumers of the project will likely already have their own solutions.

Rather than include device detection in the project enable the consumer to pass a configuration profile to the project to determine how data storage should be handled. This could simply be flags to indicate the user experience that is acceptable. For example;

  1. Allow redirects with intro card before first redirect.
  2. Allow redirects without intro card before first redirect.
  3. Don't allow redirects and prompt user to change settings to enable 3PC.
  4. Allow 3PC after checking.
  5. Assume 3PC.
  6. Check for 3PC.
  7. Use some future not yet existing solution like GDPR Validated Sets. https://github.com/privacycg/ first-party-sets/pull/86

By using an enumeration of possible flags the publisher controls how the user experience works and what features they wish to authorize.

jwrosewell commented 2 years ago

Further the publisher likely already uses a device detection solution for crawler detection and page optimization. They can use the results of that service to determine how to configure the policy for OneKey. OneKey should focus on the core services and not get involved in things publishers will have different views over. Sensible suggestions in the examples can then guide them to ensure they get to a good working solution quickly.