Skip to content

Adgeneration: Rewrite adapter to match Prebid.js v1.6.6 spec#11

Open
ss-toshihide-tajima wants to merge 4 commits into
masterfrom
feature/adg-parity-2026-04
Open

Adgeneration: Rewrite adapter to match Prebid.js v1.6.6 spec#11
ss-toshihide-tajima wants to merge 4 commits into
masterfrom
feature/adg-parity-2026-04

Conversation

@ss-toshihide-tajima
Copy link
Copy Markdown
Collaborator

Summary

  • Prebid.js v1.6.6 の adgenerationBidAdapter に仕様を合わせ、adgeneration アダプターを書き換え
  • リクエストを GET /adsv/v1 (URL クエリ) から POST /adgen/prebid (ortb JSON body) に変更
  • Native mediaType を app / site の両方で対応
  • 単体テスト (10 件) を新 API に書き換え、すべて pass

主な変更

  • エンドポイント: https://d.socdm.com/adsv/v1https://d.socdm.com/adgen/prebid
  • メソッド: GET → POST、body に ortb リクエスト全体を JSON で送信
  • Native 対応: static/bidder-info/adgeneration.yaml の capability に native を追加 (app / site 両方)
  • レスポンス読み取り: body トップレベル → results[0] 優先 (prebid.js 実装と一致)
  • sdktype: OS 別 (0/1/2) を廃止し 0 固定 (prebid.js パリティ優先)
  • idfa / advertising_id: 単独クエリ送信を廃止し device.ifa に集約
  • Native AdM: wrapNativeAdm{"native":{...}}{assets:...} の両形式を吸収 (バックエンド応答形式未確定のため両対応)
  • その他: ADomain (旧 adomain)、location_params / upper_billboard 判定、ADGBrowserMTag を追加

残作業

  • adapters/adgeneration/adgenerationtest/ 配下の JSON golden file (exemplary / supplemental) は旧 GET 形式のまま。TestJsonSamplest.Skip で退避中。POST + JSON body 形式への書き換えが別途必要
  • バックエンド (d.socdm.com/adgen/prebid) が sdkname=prebidserver のリクエストを受けて results[] 形式で応答できるか要確認
  • sdktype=0 固定で app 配信のバックエンド処理に影響がないか要確認
  • ステージング 1 媒体での疎通確認

背景

  • 4 年以上メンテされていなかった adgeneration アダプターを Prebid.js 版と揃える施策
  • 詳細調査: projects/prebid-server/research/parity-concerns.md (社内資料)

Test plan

  • go build ./... 通過
  • go test ./adapters/adgeneration/... 通過 (10 件、TestJsonSamples は Skip)
  • golden file 書き換え後に TestJsonSamples を有効化して通過確認
  • バックエンド /adgen/prebid 仕様確認後、ステージングで疎通確認

Send ortb body as JSON POST to /adgen/prebid (was GET /adsv/v1 with URL params),
matching the current Prebid.js adgenerationBidAdapter implementation.

- Endpoint: GET /adsv/v1 -> POST /adgen/prebid (JSON body)
- Add Native mediaType support for app/site
- Read bid from results[0] (was response body root)
- Drop OS-based sdktype branching (fixed to sdktype=0)
- Drop idfa/advertising_id query params (consolidated into device.ifa)
- wrapNativeAdm: handle both {"native":{...}} and {assets:...} responses
- Add ADGBrowserMTag, location_params/upper_billboard handling
- Rewrite unit tests (10 tests pass)
- TestJsonSamples is t.Skip pending golden file rewrite
- Rewrite adgenerationtest/exemplary/ and supplemental/ to the new
  POST /adgen/prebid request shape (uri/body/headers/impIDs)
- Update supplemental error cases to use expectedMakeBidsErrors
- Enable TestJsonSamples (was t.Skip), now exercises full
  MakeRequests + MakeBids round-trip against the regenerated samples
- Bump adapterver 1.0.3 -> 1.6.6 so Prebid.js / Prebid Server send the
  same ADG protocol version (sdkname still distinguishes the two)
- Native: append adResult.beaconurl to native.imptrackers in the AdM
  JSON to match createNativeAd() in adgenerationBidAdapter.js, and
  handle both {"native":{...}} and {assets:...} payload shapes
- ADGBrowserM: read marginTop from imp.ext.bidder.marginTop
  (ExtImpAdgeneration.MarginTop) instead of hardcoding '0'; fall back
  to '0' when unset, mirroring Prebid.js behavior
- Add bidder-params schema entry for marginTop
- Add unit tests covering the new ADGBrowserM marginTop wiring,
  beaconurl appending, deduplication, and wrapped native input
- Regenerate golden file adapterver fields to 1.6.6
- Replace JS-style regex literal `/\r?\n/g` with Go-native `\r?\n` so
  vastxml line breaks are actually stripped before being interpolated
  into <script> string literals (APV and ADGBrowserM paths)
- getCurrency() now mirrors Prebid.js getCurrencyType(): return "USD"
  iff request.Cur contains USD (case-insensitive), else "JPY". Drop the
  previous JPY-preferred / first-fallback behavior that could leak
  EUR/GBP downstream
- MakeBids: resolve target imp from the body we sent
  (externalRequest.Body -> ortb.imp[0].id) instead of bidResp.locationid,
  matching Prebid.js' bidRequests.data.ortb.imp[0]; this also recovers
  bids when the backend omits locationid
- buildAdMarkup: fall back to banner when adResult.native is present
  but assets[] is empty/missing, mirroring Prebid.js isNative()
- Add regression tests: vastxml newline stripping (APV/ADGBrowserM),
  USD/JPY parity cases, and native-without-assets fallback
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant