Skip to content

FreakOut Bid Adapter: add new bid adapter #1

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

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

Conversation

jhoshina
Copy link

@jhoshina jhoshina commented Dec 7, 2021

Type of change

  • New bidder adapter

Description of change

Adding FreakOut bid adapter

  • test parameters for validating bids
{
  bidder: 'freakout',
  params: {
    adspot_id: 'NTE2OjE3MTA5',
    ad_type: 14
  }
}

Be sure to test the integration with your adserver using the Hello World sample page.

  • contact email of the adapter’s maintainer: [email protected]
  • official adapter submission

For any changes that affect user-facing APIs or example code documented on http://prebid.org, please provide:

@jhoshina
Copy link
Author

jhoshina commented Dec 7, 2021

Upstream への PR について

PR comment は .github/PULL_REQUEST_TEMPLATE.md から作成したものです。

タイトル含め、おおよそこのようになるかと思いますが、いくつか確認事項があります。

  • adspot_id
    • おそらくレビュアーが確認するためのもので、エンドポイントがこの adspot_id で正しくレスポンスを返す必要がありそうです。
  • 連絡用メールアドレス
  • prebid.org へのドキュメント追加
    • prebid/prebid.github.io へ PR し、そのリンクを貼る必要があるようです。

@jhoshina
Copy link
Author

jhoshina commented Dec 8, 2021

実装概要

参考: How to Add a New Prebid.js Bidder Adapter for Header Bidding

isBidRequestValid

Bid request が妥当かどうかの判定。

adspot_id が存在するかどうかで判定しています。

buildRequests

指定パラメータから Header Bidding リクエストを生成します。各パラメータの仕様については Prebid.js · fout/rfp Wiki を参照してください。

開発用にエンドポイントの URL を変更できるようにしています。こちらは Admixer のアダプタ にも同様の実装が含まれているので問題ないとは思われます。

レスポンスの展開時に必要となるため adspotId を含めています。

interpretResponse

RFP からの Header Bidding のレスポンスを元に Prebid.js で必要となるパラメータを生成します。追加されたパラメータの仕様については Prebid.js · fout/rfp Wiki を参照してください。

creative は adapter 内で生成しており、以下の要素を含めています:

  • 広告のプレースホルダ
  • 広告レスポンスを JSON にしたもの
  • RFP SDK の読み込み
  • RFP SDK の実行

SDK の実行には 広告リクエストなしでの広告表示を実現する · Issue #342 · fout/rfp_js で実装したオプションを使用しています。

getUserSyncs

User Sync が許可に応じ Sync パラメータを返します。

レスポンス内の sync_url および sync_iframe_url を使用しています。

@jhoshina
Copy link
Author

jhoshina commented Dec 8, 2021

動作確認

ダミー広告サーバ

レスポンスにリクエストされた Bidding ID を埋め込む必要があるため、 Cloud Functions でレスポンスを返すようにしています。また、 CORS にひっかかるのでこちらの対応も必要です。

以下をダミーの広告サーバとして使用しています。

ローカル環境(Google Publisher Tag)での確認

integrationExamples/gpt/hello_world.html を以下のように変更します。

diff --git a/integrationExamples/gpt/hello_world.html b/integrationExamples/gpt/hello_world.html
index 47ba5b8f..6ee5040f 100755
--- a/integrationExamples/gpt/hello_world.html
+++ b/integrationExamples/gpt/hello_world.html
@@ -24,9 +24,9 @@
             },
             // Replace this object to test a new Adapter!
             bids: [{
-                bidder: 'appnexus',
+                bidder: 'freakout',
                 params: {
-                    placementId: 13144370
+                    adspot_id: 'NDgxOjUx',
                 }
             }]
 
@@ -45,6 +45,9 @@
         });
 
         pbjs.que.push(function() {
+            pbjs.setConfig({freakout: {
+              endpoint_url: 'https://us-central1-sandbox-5e3e0.cloudfunctions.net/headerBidding'
+            }});
             pbjs.addAdUnits(adUnits);
             pbjs.requestBids({
                 bidsBackHandler: sendAdserverRequest,
@@ -88,4 +91,4 @@
     </script>
 </div>
 </body>
-</html>
\ No newline at end of file
+</html>

ローカルサーバを動かします。

$ npm ci
$ gulp serve --notest

ブラウザで以下のURLを開きます。

  • http://localhost:9999/integrationExamples/gpt/hello_world.html?pbjs_debug=true

明滅する画像(ランダム)が表示されれば成功です。デベロッパーツールで詳細ログ等を確認できます。

Google Ad Managerでの確認

Google Ad Manager に適切な設定を行い、上と同じような設定をすることで動作を確認できました。

実際の配置先:

@jhoshina jhoshina self-assigned this Dec 8, 2021
@jhoshina
Copy link
Author

jhoshina commented Dec 8, 2021

ユニットテストについて

gulp test で確認できます。

が、外部環境に依存しているテストがあるのか、たまに失敗するものがあるようです。

Copy link

@ryo628 ryo628 left a comment

Choose a reason for hiding this comment

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

いくつかコメントと質問しました 🙇

return syncs;
}

serverResponses.forEach(res => {
Copy link

Choose a reason for hiding this comment

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

[q]

sync_script_urls の対応は不要なのでしょうか?

Copy link
Author

Choose a reason for hiding this comment

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

script urlを挿入してのSyncはサポートされていないため行っていません。

参考: Registering User Syncs

}

/**
* @return {string} USD or JPY
Copy link

Choose a reason for hiding this comment

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

[MEMO]

USD or JPY で返却される

params: {
adspot_id: 'ABCD1234'
},
adUnitCode: 'adunit-code',
Copy link

Choose a reason for hiding this comment

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

[q]

adUnitCode に対して特に何もしていませんが、問題ないのでしょうか?

Copy link
Author

Choose a reason for hiding this comment

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

adUnitCode は実際の引数には渡されてくるので記述していますが、リクエストを生成する上で特に必要ないため処理していません。

@jhoshina jhoshina requested a review from ryo628 December 13, 2021 05:50
Copy link

@ryo628 ryo628 left a comment

Choose a reason for hiding this comment

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

LGTMです 👍

@jhoshina
Copy link
Author

fout/rfp#7726 を踏まえての結合テスト

テスト用サンプルを以下のように変更:

diff --git a/integrationExamples/gpt/hello_world.html b/integrationExamples/gpt/hello_world.html
index 47ba5b8f..c74b9b60 100755
--- a/integrationExamples/gpt/hello_world.html
+++ b/integrationExamples/gpt/hello_world.html
@@ -24,9 +24,10 @@
             },
             // Replace this object to test a new Adapter!
             bids: [{
-                bidder: 'appnexus',
+                bidder: 'freakout',
                 params: {
-                    placementId: 13144370
+                    adspot_id: 'NTE2OjE3MTA5',
+                    ad_type: 14,
                 }
             }]
 
@@ -88,4 +89,4 @@
     </script>
 </div>
 </body>
-</html>
\ No newline at end of file
+</html>

レスポンス:

{
  "items": [
    {
      "ad_id": "340",
      "advertiser_id": "2",
      "conv_type": "0",
      "creative_html": "<script>function render(){const n=document.createElement('canvas');n.width=300;n.height=250;document.body||(document.body=document.createElement('body'));document.body.appendChild(n);const t=n.getContext('2d');let i=0;const r=new Image;r.onload=function(){i=t.globalAlpha;t.drawImage(r,0,0)};n.onclick=function(){window.open('{{click_url}}')};r.src='https://test-site.ad-platform.biz/freakout_300x250.png';setInterval(()=>{t.fillStyle='#FFFFFF',t.fillRect(0,0,n.width,n.height),i-=.1,i<0&&(i=1),t.globalAlpha=i,t.drawImage(r,0,0)},200)}render()</script>",
      "dat": "Qj6QYrBDs_1JiRmakg4WZYLmR7nucnt4M7KEydGjbt3cle78osoL0Uy7ip1yLSgQ",
      "session_id": "5369CCCA-FB43-11E3-8217-CBAB867B35CC",
      "optout_click": "",
      "creative_width": "300",
      "creative_height": "250",
      "ttl": "300",
      "cpm": "30",
      "cur": "JPY",
      "pb_bid": "2f1e4c4f0846a"
    }
  ],
  "viewable_impression": 1,
  "sync_iframe_urls": [
    "https://sync.example.com/1.html",
    "https://sync.example.com/2.html"
  ]
}

結果:

失敗

image

原因:

Prebid.js の Bid Response に creativeId が必須で Adapter では .item[].creative_id を参照しているが、ディスプレイ枠のレスポンスに creative_id がない(そもそも DisplayAdItem で想定されていない)。devtoolでダミーの creativeId を入れると表示されたので問題はここだけかと思われる。

bids: [{
bidder: 'freakout',
params: {
adspot_id: 'NDgxOjUx'
Copy link

Choose a reason for hiding this comment

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

[IMO]

ad_type も必須かと思いますので、PRメッセージと一緒に追記すべきかと思います。

Copy link
Author

Choose a reason for hiding this comment

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

4929394 にてドキュメントとテスト用のファイルに追加しました。

Copy link

Choose a reason for hiding this comment

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

引き続きLGTMです 👍

@jhoshina
Copy link
Author

jhoshina commented Feb 2, 2022

fout/rfp#8064 リリース後の確認

確認の内容は前回 (#1 (comment)) と同じ

レスポンス:

{
  "items": [
    {
      "ad_id": "340",
      "advertiser_id": "2",
      "conv_type": "0",
      "creative_html": "<script>function render(){const n=document.createElement('canvas');n.width=300;n.height=250;document.body||(document.body=document.createElement('body'));document.body.appendChild(n);const t=n.getContext('2d');let i=0;const r=new Image;r.onload=function(){i=t.globalAlpha;t.drawImage(r,0,0)};n.onclick=function(){window.open('{{click_url}}')};r.src='https://test-site.ad-platform.biz/freakout_300x250.png';setInterval(()=>{t.fillStyle='#FFFFFF',t.fillRect(0,0,n.width,n.height),i-=.1,i<0&&(i=1),t.globalAlpha=i,t.drawImage(r,0,0)},200)}render()</script>",
      "creative_id": "creative-1",
      "dat": "Qj6QYrBDs_1JiRmakg4WZYLmR7nucnt4M7KEydGjbt3cle78osoL0Uy7ip1yLSgQ",
      "session_id": "5369CCCA-FB43-11E3-8217-CBAB867B35CC",
      "optout_click": "",
      "creative_width": "300",
      "creative_height": "250",
      "ttl": "300",
      "cpm": "30",
      "cur": "JPY",
      "pb_bid": "26ff9cf4dc89f9"
    }
  ],
  "viewable_impression": 1,
  "sync_iframe_urls": [
    "https://sync.example.com/1.html",
    "https://sync.example.com/2.html"
  ]
}

表示内容:

正しく表示された。

image

@jhoshina
Copy link
Author

jhoshina commented Feb 4, 2022

  • adspot_id
    • おそらくレビュアーが確認するためのもので、エンドポイントがこの adspot_id で正しくレスポンスを返す必要がありそうです。

fout/rfp_go#1887 にて対応。

adspot_id ad_type
InFeed NTc2OjE3MTA4 5
Display NTE2OjE3MTA5 14
  • prebid.org へのドキュメント追加
    • prebid/prebid.github.io へ PR し、そのリンクを貼る必要があるようです。

fout/prebid.github.io#1 にて対応。

jhoshina pushed a commit that referenced this pull request Apr 23, 2024
…erter (prebid#10177)

* ET-1691: Pulsepoint Analytics adapter for Prebid. (#1)

* ET-1691: Adding pulsepoint analytics and tests for pulsepoint adapter

* ET-1691: Adding pulsepoint analytics and tests for pulsepoint adapter

* ET-1691: cleanup

* ET-1691: minor

* ET-1691: revert package.json change

* Adding bidRequest to bidFactory.createBid method as per prebid#509

* ET-1765: Adding support for additional params in PulsePoint adapter (prebid#2)

* ET-1850: Fixing prebid#866

* Minor fix

* Adding mandatory parameters to Bid

* Switching to ortbConverter

* updating docs

---------

Co-authored-by: Eugene Rachitskiy <[email protected]>
jhoshina pushed a commit that referenced this pull request Apr 23, 2024
* Kimberlite bid adapter (#1)

* initial: bid adapter

* styling

* Fix: lint (prebid#2)

* Fix: lint (prebid#4)

* review fixes (prebid#6)

* Change: filling request.ext.prebid section (prebid#7)

---------

Co-authored-by: Oleg <[email protected]>
jhoshina pushed a commit that referenced this pull request Apr 23, 2024
* PE-87: Implement Prebid Adapter (#1)

* PE-87: implement BT Bid Adapter

* PE-87: rework adapter to use ortbConverter lib, make requested changes

* PE-87: update imports

* PE-110: Add user sync logic to the Prebid Adapter (prebid#3)

* PE-110: add user sync logic

* PE-110: update userSync url

* PE-110: check if iframe is enabled before setting params

* PE-111: BT Prebid Adapter can request AA ads or regular ads (prebid#2)

* PE-120: Send Prebid Bidder info to BT Server (prebid#4)

* PE-120: add btBidderCode to the bid object

* PE-120: use single quotes for logs string

* PE-123: Add More Metadata in site.ext.blockthrough (prebid#5)

* PE-123: send additional meta data

* PE-123: send auctionID under imp.ext.prebid.blockthrough

* PE-123: use ortb2 config to set site.ext params

* PE-123: sent auctionId in ext.prebid.blockthrough.auctionID

* PE-123: update logs for bidderConfig setup

* PE-000: check if blockthrough is defined (prebid#6)

* PE-87: remove BT specific logic (prebid#7)

* Implement Blockthrough Prebid Adapter

* PE-87: Implement Prebid Adapter - misc fixes (prebid#9)

* PE-87: rename test file, add bidder config

* PE-87: increase ttl

* PE-000: fix test

* BP-74: Change the way we enable debug (prebid#10)

* BP-79: Send GPID as a part of `imp[].ext` (prebid#11)

* BP-79: send gpid in imp.ext

* BP-79: add optional operator

* BP-90: Update Cookie Sync Logic (prebid#12)

* BP-90: pass bidder to cookie sync

* BP-90: update sync logic, fix typo

* BP-90: use const for syncs variable

* BP-55: Re-add endpoint URLs (prebid#13)

* BP-91: Add prebid JS version to auction request (prebid#14)
@jhoshina
Copy link
Author

jhoshina commented Apr 23, 2024

  • Activity Controls 対応
    • メンテナ側の一斉対応に合わせる形で修正 (f376f06)
  • utils.js の構成変更対応
    • tryAppendQueryString のインポート元を変更

@jhoshina
Copy link
Author

動作確認

ディスプレイ広告のみ確認を行った(インフィード広告は非対応)

#1 (comment) と同様の確認を行った。

ローカルでの確認

image

問題なし。

GAM 経由での確認

URL は前回から変更、 prebid.js のみ新たにビルドしたものに差し替えた。
https://sandbox-f3722.web.app/

問題なし。

@ryo628 ryo628 self-requested a review April 26, 2024 06:20
@ryo628
Copy link

ryo628 commented Apr 26, 2024

引き続きLGTMです

@ryo628 ryo628 removed their request for review April 30, 2024 01:59
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.

2 participants