51Degrees / device-detection-go

European Union Public License 1.2
0 stars 3 forks source link

Bad detection of Chrome Mobile #5

Closed barbiedrummer closed 2 years ago

barbiedrummer commented 2 years ago

We are using Enterprise-HashV41.hash with golang library.

Latest db (3/21/2022) detects property BrowserName of user-agent Mozilla/5.0 (Linux; Android 11; RMX3261) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/100.0.4896.46 Mobile Safari/537.36 as "Chrome".

But on https://51degrees.com/developers/user-agent-tester the same ua is detected as "Chrome Mobile".

As we suggest there is some problem with detection in Enterprise-HashV4 db.

jwrosewell commented 2 years ago

As the user-agent value relates to Android then the response we would expect would be "Chrome Mobile" as confirmed by the User-Agent tester page. If you are using the on premise data file then there could be differences related to the Predictive and Performance algorithm. See this documentation. You might wish to switch to predictive if you're sensitive to pre-release versions that we will not have received a great deal of training data for. Chrome 100 is in beta at the moment so will appear in relatively low volume in training data.

krpn commented 2 years ago

@jwrosewell, which algorithm is used by user-agent tester page?

jwrosewell commented 2 years ago

Predictive. See the Device Metrics page.

image

krpn commented 2 years ago

@jwrosewell, thank you. Setting predictive doesn't help:

image

Database version: 3/21/2022

Does user-agent tester database have the same version?

krpn commented 2 years ago

Double checked - predictive method is used by me.results.Method() returns 3 which means dd.Predictive.

krpn commented 2 years ago

Full example (Enterprise-HashV41.hash - 3/21/2022):

func Test51DegreesV4_Predictive(t *testing.T) {
    manager := dd.NewResourceManager()
    defer manager.Free()

    config := dd.NewConfigHash(dd.Balanced)
    config.SetUsePredictiveGraph(true)
    _ = dd.InitManagerFromFile(manager, *config, "", "/Users/alexkrupin/Downloads/Safari/Enterprise-HashV41.hash")

    results := dd.NewResultsHash(manager, 1, 0)
    defer results.Free()
    _ = results.MatchUserAgent("Mozilla/5.0 (Linux; Android 11; RMX3261) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/100.0.4896.46 Mobile Safari/537.36")

    fmt.Println(results.ValuesString("BrowserName", ","))
    fmt.Println(results.Method())
}

Output:

Chrome <nil>
3
krpn commented 2 years ago

I think issue should be opened :)

jwrosewell commented 2 years ago

Reopening as there is now evidence this could relate to the go API.

Could you you also add the following line to the config.

config.SetUsePerformanceGraph(false)
krpn commented 2 years ago

@jwrosewell, added. Nothing is changed.

jwrosewell commented 2 years ago

Thanks. We'll triage in the next week and let you know what we find.

krpn commented 2 years ago

@jwrosewell, thank you. Very much looking forward to. Now will rollback to one week for datafile.

krpn commented 2 years ago

It worked correctly on 3/15/2022 datafile.

Maybe problem is not in the library? As I see we used predictive mode always, because it used by default. Removing config.SetUsePredictiveGraph(true) doesn't change return of results.Method(). It returns 3 anyway.

tungntpham commented 2 years ago

@krpn,

Thanks for the update. We can confirm that this can be reproduced in our environment. We will investigate and keep you updated.

Tung.

krpn commented 2 years ago

@tungntpham @jwrosewell looking fixed in 3/24/2022. Output now (code here):

Chrome Mobile <nil>
3
bziaks commented 2 years ago

Similar issue here with Chrome and Chrome Mobile: enterprise-db (3/29/2022) detects UA Mozilla/5.0 (Linux; Android 11; SM-A515F) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/99.0.4844.88 Mobile Safari/537.36 as Chrome if we use Client Hints and as Chrome Mobile if we use only User-Agent for detection. OS is Android in both cases.

Steve51D commented 2 years ago

Thanks @bziaks,

Currently, our product does not have 'full' support for User Agent Client Hints. This is mainly due to the changes that kept being made to the UA-CH specification and lack of clarity around the timetable. This means that the results when using UA-CH values with the current data files and API can be less than ideal.

However, we are now close to rolling out both API updates and data files that will work fully with UA-CH. We plan on the API version that fully supports UA-CH being 4.4. We're not certain on the date of the first data files yet, but expect those to be available for testing in the next week or so, and to replace the current data files in production within a few more weeks.

To be clear, older API versions and data file versions can still be used, and are cross compatible with each other. It's just that to get the best results, we will recommend using version 4.4 of the API along with the most recent data files.

krpn commented 2 years ago

Any progress with this? :)

Steve51D commented 2 years ago

Yes, we're actually just preparing an update to go out to all customers on this.

Version 4.4.x of the API has been available for a few days and the updated data files are now being made available on request. I'll update here once I have more details.

krpn commented 2 years ago

@Steve51D, thank you very much!

Steve51D commented 2 years ago

The updated v4 (hash) data files have been live on our cloud service for about a month now and have now replaced the previous ones in all scenarios. These will be picked up as part of your existing automatic update process.

To manually download the latest files, see http://51degrees.com/developers/downloads/enhanced-device-data

Please let us know if you experience any issues.