Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

51Degrees RTD submodule: initial commit #11414

Open
wants to merge 20 commits into
base: master
Choose a base branch
from

Conversation

jwrosewell
Copy link

Type of change

  • Feature
  • New RTD submodule

Description of change

51Degrees module enriches an OpenRTB request with 51Degrees Device Data.

51Degrees module sets the following fields of the device object: make, model, os, osv, h, w, ppi, pixelratio - interested bidder adapters may use these fields as needed. In addition the module sets device.ext.fiftyonedegrees_deviceId to a permanent device ID which can be rapidly looked up in on premise data exposing over 250 properties including the device age, chip set, codec support, and price, operating system and app/browser versions, age, and embedded features.

The module supports on premise and cloud device detection services with free options for both.

Integration details are specified in the modules/51DegreesRtdProvider.md.

Maintainer contacts:

support@51degrees.com

Other details

The features provided by this module have been requested previously as part of: #8217

BohdanVV and others added 7 commits April 28, 2024 19:02
…g additional information and resources.

Added an exception if the resourceKey parameter is not updated from the example.
Added a customer notices section to the readme.
Used User Agent Client Hint (UA-CH) consistently in the documentation.
<html lang="en">
<head>
<meta http-equiv="Delegate-CH" content="sec-ch-ua-full-version-list https://cloud.51degrees.com; sec-ch-ua-model https://cloud.51degrees.com; sec-ch-ua-platform https://cloud.51degrees.com; sec-ch-ua-platform-version https://cloud.51degrees.com">
<script async src="//www.googletagservices.com/tag/js/gpt.js"></script>
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Outdated url

cache: {
url: false
},
realTimeData: {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This whole block barely adds any value beyond your documentation. Are you sure you want to maintain it?

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the heads up, I've removed this part

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm confused, you still have this file in your pr?

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @patmmccann, sorry we thought you meant just the cache block in that configuration json, but in general yes - we'd like to maintain this example page as it is the way to demo and test the module. For now this is convenient as not many client-side adapters implement echoing the full oRTB device object to their servers. We'll also add the output of the enriched oRTB object to the page itself - should be handy for testing on mobile devices. Thanks

['SmartWatch', ORTB_DEVICE_TYPE.CONNECTED_DEVICE],
['Tablet', ORTB_DEVICE_TYPE.TABLET],
['Tv', ORTB_DEVICE_TYPE.CONNECTED_TV],
['Vehicle Display', ORTB_DEVICE_TYPE.PERSONAL_COMPUTER]
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hopefully not too many drivers viewing ads ;)

* @param {string} url 51Degrees JS URL
* @returns {Promise} Promise that resolves when the script is loaded
*/
export const inject51DegreesScript = (url) => {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You have to use our injection methods or simply rely on the script already being injected by another method

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@patmmccann thanks for the comment. Just wanted to clarify:

  1. by "our injection methods" - do you mean loadExternalScript API from adloader.js?
  2. If so we'd need to add our module code into _approvedLoadExternalJSList, I assume it should also be part of this PR, right?
  3. by "another method" do you mean that the user may insert the script tag themselves at the point of embedding Prebid.js into the page when providing configuration, or is it something else?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, yes, yes

logMessage('On-premise JS URL: ', onPremiseJSUrl);

// Get 51Degrees JS URL, which is either cloud or on-premise
const scriptURL = get51DegreesJSURL(resourceKey ? {resourceKey} : {onPremiseJSUrl});
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you're using prebid to inject, we prefer you lock versions and pr the project when the script changes

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The script is generated by the 51Degrees Cloud API that is version-locked through its URL: https://cloud.51degrees.com/api/v4/<your_resource_Key>.js, however the script itself is generated based on resource-key and properties user selects for it - so we would not be able to store its content as part of this repo. The javascript template and device detection library used by the cloud are open source (as mentioned in our docs):

Copy link
Collaborator

@patmmccann patmmccann left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A few remarks in line

}

/**
* Check if meta[http-equiv="Delegate-CH"] tag is present in the document head and points to 51Degrees cloud
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What's going on here, why not just get the high entropy hints in js

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the comment. Agreed that in general it's a good idea to use getHighEntropyValues API. The injected script actually uses it as a fallback in the case when navigator did not send User-Agent Client Hints as part of the first request. Having the navigator send the User-Agent Client Hints by itself seems to be a bit more performant and also transparent to the user that they give permission to a 3rd party to process those as prescribed by the spec

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FWIW - PBJS-core will add high entropy device.sua if the publisher sets some config...

pbjs.setConfig({
       firstPartyData: {
         uaHints: ['platform', 'architecture', 'model', 'platformVersion', 'fullVersionList']
       }
});

This may be something you want to suggest in your doc?

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for raising this, @bretg. A lengthy comment ahead, but we hope it will become a basis for more documentation. Breaking it down below.

PBS modules

The First Party Data Enrichment module with uaHints mentioned above is very relevant for 51D Prebid Server Modules, and we'll actually add it to the server modules docs, because 51D PBS modules are more precise when device.sua is present in the request.

Prebid.js module

51D Prebid.js module injects a dynamically generated script based on the evidence available. It also falls back to the GetHighEntropyValues API, but does not rely on it as a first (or only) choice route - please see the illustrative cases below. Albeit it seems easier, GHEV API is not supported by all browsers (so the decision to call it should be conditional) and also even in Chrome this API will likely be a subject to the Privacy Budget in the future.

In summary we use Delegate-CH http-equiv as the preferred method of obtaining the necessary evidence because it is the fastest method, and future proof. Delegate-CH enables the Chromium-based browser to send the User-Agent Client Hints to a 3rd party right away on the very first request unlike Accept-CH + Permissions-Policy http response headers which would let it send them on subsequent requests. Hence this check in the code that outputs the warning in debug mode.

Illustrative Cases

  • if the device is iPhone/iPad then there is no point checking for or calling GetHighEntropyValues at the moment because iOS does not support this API. However this might change in the future.
    Platforms like iOS require additional techniques to identify the model which are not covered via a single API call, and change from version to version of the operating system and browser rendering engine. When used with iOS 51Degrees resolves the iPhone/iPad model groups using these techniques. That is one of the benefits the module brings to the Prebid community as most solutions do not resolve iPhone/iPad model groups. More on Apple Device Detection here.

  • if the browser is Brave on Android then there is similarly no point requesting GHEV as the API is not supported.

  • if the browser is Chrome then the Delegate-CH if enabled by the publisher would enable the browser to provide the necessary evidence. However if this is not implemented - then the dynamic script would fall back to GHEV which is slower.

As the code for these features changes frequently the relevant snippets are in the data file rather than the core source code. As the web diverges the ability to dynamically adapt is going to be very important. Reducing the depency on Javascript and maximising server side stable controlled environments is part of the 51Degrees approach.

modules/51DegreesRtdProvider.js Fixed Show resolved Hide resolved
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants