◆ getEvidenceIterable()
| static Iterable<Map<String, String> > fiftyone.devicedetection.examples.shared.EvidenceHelper.getEvidenceIterable | ( | File | yamlFile | ) | throws IOException |
Create an Iterable<Map<String, String>> for reading documents from the passed yamlFile.
- Parameters
-
- yamlFile - a yamlFile
- Returns
- an Iterable
- Exceptions
-
- IOException - for file errors
◆ getEvidenceList()
static List<Map<String, String> > fiftyone.devicedetection.examples.shared.EvidenceHelper.getEvidenceList ( File yamlFile, int max ) throws IOException staticLoad a Yaml file as a list of documents (each being a Map containing evidence)
- Parameters
-
- yamlFile - a yaml file
- max - maximum entries
- Returns
- a List
- Exceptions
-
- IOException - in case of error
◆ setUpEvidence()
static List<Map<String, String> > fiftyone.devicedetection.examples.shared.EvidenceHelper.setUpEvidence ( ) staticPrepare evidence for use in examples.
A note on User-Agent Client Hint representations: There are 3 common ways to represent UACH:
- HTTP header map
- getHighEntropyValues() JS API call result in JSON format
- Structured User Agent Object from OpenRTB 2.6
Links:
51Degrees historically used HTTP header map to represent User-Agent Client Hints and expected the evidence to be provided as HTTP headers (or same name query parameters). The header names in question are:
- Sec-CH-UA
- Sec-CH-UA-Platform
- Sec-CH-UA-Mobile
- Sec-CH-UA-Model
- Sec-CH-UA-Full-Version-List
- Sec-CH-UA-Platform-Version
- Sec-CH-UA-Arch
- Sec-CH-UA-Bitness
However in version 4.5 we introduced the ability to perform device detection using the 2 other User-Agent Client Hints representations as evidence (internally it is done through conversion to the HTTP-header representation but it's an implementation detail). The 2 evidence parameter names in question are:
51D_gethighentropyvaluesand51D_structureduseragent- the engine consumes them as either query or cookie params.query.51D_gethighentropyvaluesorcookie.51D_gethighentropyvaluesis a base64-encoded JSON-string result of calling a getHighEntropyValues() API, that normally would return a value similar to the below:{"architecture":"arm","brands":[{"brand":"Google Chrome","version":"131"},{"brand":"Chromium","version":"131"} ,{"brand":"Not_A Brand","version":"24"}],"fullVersionList":[{"brand":"Google Chrome","version":"131.0.6778.140"} ,{"brand":"Chromium","version":"131.0.6778.140"},{"brand":"Not_A Brand","version":"24.0.0.0"}], "mobile":false,"model":"","platform":"macOS","platformVersion":"15.1.1"}
to obtain the below evidence we called this JavaScript snippet in the Chrome browser dev console: ‘btoa(JSON.stringify(await navigator.userAgentData.getHighEntropyValues( ['bitness’, 'architecture','fullVersionList','model', 'platformVersion'])))`
query.51D_structureduseragentorcookie.51D_structureduseragentis a JSON-string representation of User-Agent Client Hints used in the OpenRTB 2.6
