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

Add mergeConfig functions for updating ortb2 data #6425

Closed
bretg opened this issue Mar 16, 2021 · 3 comments · Fixed by #7396
Closed

Add mergeConfig functions for updating ortb2 data #6425

bretg opened this issue Mar 16, 2021 · 3 comments · Fixed by #7396

Comments

@bretg
Copy link
Collaborator

bretg commented Mar 16, 2021

Type of issue

enhancement

Description

There are several parties that might want to add to the new First Party Data structure. Currently, Real Time Data modules need to getConfig({ortb2}), modify it, then setConfig({ortb2}). This is awkward.

This issue proposes two convenience functions to make it easier for RTD modules (and page code) to manage important data structures. So while the main use case is ortb2, the proposal is that these new functions would apply to all setConfig entries.

  1. mergeConfig({CONFIG})
pbjs.mergeConfig({
  ortb2: {
    user: {
      data: [
         {
          "name": "www.dataprovider1.com",
          "ext": { "taxonomyname": "iab_audience_taxonomy" },
          "segment": [{ "id": "687" }, { "id": "123" }]
         }
      ]
    }
  }
});

This command would add the specified ortb2.user.data array element to the existing ortb2 data structure or create if it doesn't already exist.

Requirements:

  1. mergeConfig should create the object if it doesn't already exist
  2. mergeConfig should add entries to the end of the following arrays: ortb2.site.keywords, ortb2.user.keywords, ortb2.user.data and ortb2.site.content.data arrays rather than overwriting them. The function does not have to check for duplicate array entries. [Are there other arrays we want to add to rather than overwriting?]
  3. Otherwise mergeConfig should give precedence to the new values over existing values. [I believe this is the current convention given regular JavaScript Object.assign() semantics]
  1. mergeBidderConfig({bidder: [BIDDERS], config: CONFIG})
pbjs.mergeBidderConfig({
  bidders: ["bidderA", "bidderB"],
  config: {
    ortb2: {
      user: {
        data: [
           {
            "name": "www.dataprovider1.com",
            "ext": { "taxonomyname": "iab_audience_taxonomy" },
            "segment": [{ "id": "687" }, { "id": "123" }]
           }
        ]
      }
    }
  }
});

This command would add the specified ortb2.user.data array element to the existing ortb2 data structure for bidderA and bidderB or create if it doesn't already exist.

Same requirements as mergeConfig noted above.

@bretg bretg added the feature label Mar 16, 2021
@bretg bretg changed the title Add a mergeConfig function for updating ortb2 data Add a mergeConfig functions for updating ortb2 data Mar 16, 2021
@bretg bretg changed the title Add a mergeConfig functions for updating ortb2 data Add mergeConfig functions for updating ortb2 data Mar 16, 2021
@bretg bretg added the taxonomy label Mar 16, 2021
@patmmccann
Copy link
Collaborator

would this functionality live in the rtd parent module?

@gglas
Copy link

gglas commented Apr 12, 2021

@bretg is there a connected PR for this? Seems fine to me

@bretg
Copy link
Collaborator Author

bretg commented Apr 12, 2021

@patmmccann - the proposal is that this is a new utils function generally available to everyone.

@gglas - Magnite jira ticket open. There will be PR soon

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants