prebid / prebid-server

Open-source solution for running real-time advertising auctions in the cloud.
https://prebid.org/product-suite/prebid-server/
Apache License 2.0
433 stars 741 forks source link

Getting accountId from self hosted PBS Go (for testing purposes) #2472

Open MatejaMaric opened 1 year ago

MatejaMaric commented 1 year ago

I'm setting up a Prebid Server test environment. I spawn Prebid Server Docker container with PBS_GDPR_DEFAULT_VALUE set to 0 and I'm using Prebid.js-GPT-PBS integration example. I want to get a test ad show instead of "All Bidders Took Too Long or No Bid" message that I currently get. I guess the problem is that accountId in that Prebid.js example is just set to 1 instead of a real value, although I don't know how to get an accountId. I saw there was a similar question (#2073) where somebody said that PBS Go accounts are configured by an API endpoint, however I'm unable to find any documentation on the subject...

Here's the changes that I applied to the Prebid.js example:

--- prebidServer_example.html   2022-11-29 10:25:13.000000000 +0100
+++ pbs.html    2022-11-29 10:31:01.000000000 +0100
@@ -26,7 +26,7 @@
         var pbjsEl = document.createElement("script");
         pbjsEl.type = "text/javascript";
         pbjsEl.async = true;
-        pbjsEl.src = '/build/dev/prebid.js';
+        pbjsEl.src = 'https://cdn.jsdelivr.net/npm/prebid.js@latest/dist/not-for-prod/prebid.js';
         var pbjsTargetEl = document.getElementsByTagName("head")[0];
         pbjsTargetEl.insertBefore(pbjsEl, pbjsTargetEl.firstChild);
       })();
@@ -51,13 +51,27 @@

         pbjs.setConfig({
           bidderTimeout: 3000,
+          debug: true,
+          ortb2: {
+              test: 1
+          },
           s2sConfig : {
             accountId : '1',
             enabled : true, //default value set to false
+            testing: true,
+            testServerOnly: true,
+            bidderControl: {
+              appnexus: {
+                bidSource: {server: 100, client: 0},
+                includeSourceKvp: true
+              }
+            },
             defaultVendor: 'appnexus',
             bidders : ['appnexus'],
             timeout : 1000, //default value is 1000
             adapter : 'prebidServer', //if we have any other s2s adapter, default value is s2s
+            endpoint: 'http://localhost:8000/openrtb2/auction',
+            syncEndpoint: 'http://localhost:8000/cookie_sync',
           }
         });
bretg commented 1 year ago

@MatejaMaric - there's no need to get an account ID from anywhere. Each company that hosts PBS allocates their own IDs. It seems like the real issue here is that better documentation is needed on how to standup a local server and get a response. Nowadays we're recommending the use of 'stored responses' for this kind of testing. @SyntaxNode has offered to post an outline of this for PBS-Go, and I'll take the item for PBS-Java.

MatejaMaric commented 1 year ago

Hello @bretg , thanks for the reply! I guess I was confused since I kind of expected that Prebid.js example that I showed would display some kind of a test ad.

Anyway, I managed to create a local test environment by creating my own PBS Adapter and a mock bidder. Adapter would just pass the OpenRTB BidRequest to my mock bidder which would then create a mock OpenRTB BidResponse with an Ad HTML in the AdM field. I would run both the mock bidder and my version of PBS locally. I also added an AdUnit for my bidder to the Prebid.js example that would then connect to my local PBS and serve the Ad that I created. I hope the helps somebody.

I'm interested if there is already some kind of PBS Adapter that just forwards the OpenRTB requests and responses? From what I saw every company that uses PBS makes their own adapter.

P.S. Maybe, it would be good to leave an comment on setting up AccountIDs in this issue (or just a link to the docs, when they are complete), just in case somebody searches for answers and finds this issue. 😃