prebid / Prebid.js

Setup and manage header bidding advertising partners without writing code or confusing line items. Prebid.js is open source and free.
http://prebid.org
Apache License 2.0
1.26k stars 2.02k forks source link

User id Module sample rate #10705

Open jdwieland8282 opened 8 months ago

jdwieland8282 commented 8 months ago

Problem

Publishers are unable to test and run experiments natively in Prebid and must rely on partners to help set up tests & control groups when they want to test various setConfig() objects.

example

A publisher may wish to test CPM change for 2 different setConfig()s

1

 pbjs.setConfig({
     userSync: {
         userIds: [{
             name: "sharedId",
             storage: {
                 type: "cookie",
                 name: "_sharedid",         
                 expires: 365         
             }
         }]
     }
 });

2

 pbjs.setConfig({
     userSync: {
         userIds: [{
             name: "OtherID",
             storage: {
                 type: "cookie",
                 name: "_OtherID",       
                 expires: 365             
             }
         }]
     }
 });

UseCase

  1. As a publisher I want to test how my inventory monetizes when I include a userid module subadapter like sharedid, I want to be able to compare the presence of sharedid against no user id at all.
    1. As a publisher I want to test how my inventory monetizes when I include a userid module subadapter like sharedid, I want to be able to compare the presence of sharedid against a different user id such as "OtherID"

Requirements

  1. setConfig() should support a sample rate int for the test cohort. Where n percent of the time the setConfig() loads one way, and n of the time it loads a different way.
  2. Prebid must signal back to the publisher what imps were part of the test and which were part of the control. ex.
    • configureable response endpoint where Impression id and cohort label (test or control) are logged.

curl --location 'http://pub.com/prebid/experiement?
--header 'Content-Type: application/json' \
--data '{
  "entries": [
    {
      "impression": 12345,
      "cohort": "test" //control
    }
  ]
}'
patmmccann commented 7 months ago

I think with documentation we can completely solve:

if crypto.getRandom.... or Math.random() > .5 then set a else set b
if a setconfig(one way)
if b setconfig(other way)
googletag.setTargeting(test=[a or b])
and/or the generic analytics adapter could be aware of the test

There seems to be a bit of a gap expressing tests to analytics adapters, but if we form a convention, we should be good.

how about

pbjs.mergeConfig {

analyticsLabels: {
test1 : a,
test2 : d }
}

Then we could have genericAnalytics pick up analyticsLabels by adding analyticsLabels to each event and making sure it went over the wire. Other analytics modules could be Pr'd to do the same by their maintainers.

patmmccann commented 7 months ago

@jdwieland8282 tentatively marking ready for dev but we'd love your feedback before getting started

cc @3link

3link commented 7 months ago

@patmmccann Very nice initiative! Thanks for tagging. LGTM.

jdwieland8282 commented 7 months ago

So long as the requirements are met I express my support for this implementation approach.

dgirardi commented 1 month ago

This is marked in progress - is it in progress?