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

ADS-4131 Add LiftIgniterAnalyticsAdapter #23

Merged
merged 1 commit into from
Jun 17, 2020

Conversation

yonran
Copy link

@yonran yonran commented Jun 13, 2020

This change adds LiftIgniterAnalyticsAdapter, which sends the CPM from AuctionEnd to LiftIgniter.

It’s sort of based on mavenAnalyticsAdapter (hummingbird). Like mavenAnalyticsAdapter, this adapter waits 1s after the auctionEnd event before sending the event to LiftIgniter. Like mavenAnalyticsAdapter, it combines multiple auctionEnd events into a single request. (Hopefully we don’t hit the Google Load Balancer’s 16KiB headers + URL limit.) And unlike mavenAnalyticsAdapter, it only sends the auction’s id and the ad units’ code and cpm for now.

Current format:

$p('send', 'prebid', {
  batch: JSON.stringify([
    {
      auc: args.auctionId,
      codes: [adUnit.code],  // one per ad unit; can be zipped with cpms
      cpms: [max(bid.cpm)],  // one per ad unit
  ])
})

Sample batch:

[
  {
    "auc": "17beb41d-d650-40a2-90bf-011e0635012a",
    "codes": [
      "ad-efb258fe6fee427e991a9c7ba76927a9",
      "ad-a05abdb5a6be42b6a1a738c9dc0442c0",
      "ad-b1b93a0e4cda4ed3a52f939ec505ca7c",
      "ad-7e3da3ca8639437e92fff1fae3ad83e7",
      "ad-5d118e9a51e446fda8e37d5a3157109e"
    ],
    "cpms": [
      0,
      0,
      0,
      0,
      0
    ]
  }
]

This compares to mavenAnalyticsAdapter (hummingbird), which has many more fields:

\d hummingbird_auction
                               Table "admin.hummingbird_auction"
       Column        |           Type           | Collation | Nullable |        Default        
---------------------+--------------------------+-----------+----------+-----------------------
 auction_id          | character varying(50)    |           | not null | 
 correlator          | bigint                   |           | not null | 
 country_code        | character(2)             |           | not null | 
 maven_channel       | character varying(40)    |           | not null | 
 path                | character varying(2000)  |           | not null | 
 pod                 | smallint                 |           | not null | 
 production_domain   | character varying(40)    |           | not null | 
 screen_size         | character(1)             |           | not null | 
 timeout_period      | integer                  |           | not null | 
 bidder              | character varying(20)    |           | not null | 
 action              | character(1)             |           | not null | 
 cpm_mills           | integer                  |           |          | 
 time_to_respond     | integer                  |           |          | 
 adzone_id           | character varying(50)    |           |          | 
 zone_name           | character varying(20)    |           |          | 
 zone_index          | smallint                 |           |          | 
 datetime            | timestamp with time zone |           | not null | 
 content_item_id     | character varying(32)    |           | not null | ''::character varying
 is_deal             | boolean                  |           |          | 
 deal_id             | character varying(50)    |           |          | 
 conn_effective_type | character varying(20)    |           |          | 
 browser_type        | character varying(20)    |           |          | 

Copy link

@partha0solapurkar partha0solapurkar left a comment

Choose a reason for hiding this comment

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

I approve the data format, but someone who is familiar with the codebase should review the actual changes

Copy link

@snark snark left a comment

Choose a reason for hiding this comment

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

So this looks broadly right to me, but if we want to offer this as a public Prebid.js adapter--which I think we should, as there are LiftIgniter clients not on any of the Maven platforms, correct?--we want to handle the sampling behavior slightly differently. In particular, we want to accept samplingFactor as a config option (this is going to be in the form of an int n, where the sampling factor is 1/n--i.e. "20" means sample at a 5% rate) in addition to sampling. If you take a look at the rubiconAnalyticsAdapter in the repo, you can see how they've set it up. Once you do that, you can in fact hand it off to baseAdapter.enableAnalytics.call(this, config), and let the PBJS code handle the dice roll for you. (We don't do this on Tempest with mavenAnalyticsAdapter, because we want Tempest to have the ability to force-override this behavior, but the LI adapter will be less tightly integrated with Tempest and I don't think needs that.)

@martiantim
Copy link

I wonder if we should give this a more Maven-y name? MavenRecommendationAdapter? MavenDistributionAdapter?

@yonran
Copy link
Author

yonran commented Jun 16, 2020

Vipul and Partha said that they want zone names (e.g. ["fixed_bottom", "in_content"]) and indexes (e.g. [0, 0]) instead of adUnit codes (e.g. ["ad-2187d2c4fe0e41cba63ce02d28fc202e", "ad-44c4b8c1c5a14d01bc57e15f4441c18a"]), so I have changed the format.

@snark I rg’d samplingFactor and found that the only references are inrubiconAnalyticsAdapter, so it is the only adapter that supports this option as an alternative to sampling. Therefore, I don’t think it should be added.

In the latest commit I made it use an AnalyticsAdapter object as a base. I am a bit concerned that the code for queuing requests until window[global] is available seems to be broken because this conditional (if (analyticsType === ENDPOINT || BUNDLE) {…}) is always true. Hopefully this doesn’t break when that code is fixed.

@martiantim I am open to any name change

@yonran yonran force-pushed the ADS-4131-send-ad-auction-bids-to-liftigniter branch from 3cec7ab to 6eb6830 Compare June 16, 2020 22:48
@yonran
Copy link
Author

yonran commented Jun 16, 2020

I rebased to combine all the commits into one and set the author.

Copy link

@snark snark left a comment

Choose a reason for hiding this comment

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

This looks solid to me. +1.

@snark
Copy link

snark commented Jun 17, 2020

Do we want to have a separate liftigniter feature flag? We currently use a use-prebid-next feature flag for activating the "prebid-next.js" script instead of the normal one, which is what I was thinking of when I mentioned feature flags. (If we do want to use a separate liftigniter feature flag, that's fine, just not what I was thinking of).

@yonran
Copy link
Author

yonran commented Jun 17, 2020

Do we want to have a separate liftigniter feature flag? We currently use a use-prebid-next feature flag for activating the "prebid-next.js" script instead of the normal one, which is what I was thinking of when I mentioned feature flags. (If we do want to use a separate liftigniter feature flag, that's fine, just not what I was thinking of).

Are you saying that I should take out if (this.features.isEnabled('use-liftigniter-prebid-analytics') && config.pbjsConfig) in PrebidJS.js of themaven-net/tempest-phoenix#417?

@yonran yonran force-pushed the ADS-4131-send-ad-auction-bids-to-liftigniter branch from a120e5d to e450af7 Compare June 17, 2020 19:30
@yonran
Copy link
Author

yonran commented Jun 17, 2020

I have taken @martiantim ’s suggestion and renamed it to mavenDistributionAnalyticsAdapter.

Copy link

@martiantim martiantim left a comment

Choose a reason for hiding this comment

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

+1!

@snark
Copy link

snark commented Jun 17, 2020

@yonran Yes, sorry, I was commenting on the wrong PR. I'll move my comments over there.

@yonran yonran merged commit a8a492d into stable Jun 17, 2020
santii7395 pushed a commit that referenced this pull request Aug 28, 2023
* KargoBidAdapter: GPP Support

* kargo adapter to forward schain object (#21)

* wrap in if statement (#22)

* KRKPD-572: Add spec for schain (#23)

* wrap in if statement

* update test for schain, file formatting

---------

Co-authored-by: Jeremy Sadwith <jeremy@kargo.com>
santii7395 pushed a commit that referenced this pull request Aug 28, 2023
* KargoBidAdapter: GPP Support

* kargo adapter to forward schain object (#21)

* wrap in if statement (#22)

* KRKPD-572: Add spec for schain (#23)

* wrap in if statement

* update test for schain, file formatting

---------

Co-authored-by: Jeremy Sadwith <jeremy@kargo.com>
santii7395 pushed a commit that referenced this pull request Nov 9, 2023
* KargoBidAdapter: GPP Support

* kargo adapter to forward schain object (#21)

* wrap in if statement (#22)

* KRKPD-572: Add spec for schain (#23)

* wrap in if statement

* update test for schain, file formatting

* Adding site to Kargo adapter.

* KRKPD-619 Updating Site object.

* KRKPD-619 Adding null check for  Site object.

* Update modules/kargoBidAdapter.js

Co-authored-by: Julian Gan  <juliangan07@gmail.com>

* Reducing the size of Site object.

* remove white space that is causing linting error

---------

Co-authored-by: Jeremy Sadwith <jeremy@kargo.com>
Co-authored-by: Julian Gan <juliangan07@gmail.com>
santii7395 pushed a commit that referenced this pull request Nov 9, 2023
* KargoBidAdapter: GPP Support

* kargo adapter to forward schain object (#21)

* wrap in if statement (#22)

* KRKPD-572: Add spec for schain (#23)

* wrap in if statement

* update test for schain, file formatting

* Adding site to Kargo adapter.

* KRKPD-619 Updating Site object.

* KRKPD-619 Adding null check for  Site object.

* Update modules/kargoBidAdapter.js

Co-authored-by: Julian Gan  <juliangan07@gmail.com>

* Reducing the size of Site object.

* remove white space that is causing linting error

* Kargo Bid Adapter: Updates to gpid retrieval

---------

Co-authored-by: Julian Gan <juliangan07@gmail.com>
Co-authored-by: Neil Flynn <nflynn@kargo.com>
santii7395 pushed a commit that referenced this pull request Nov 9, 2023
* KargoBidAdapter: GPP Support

* kargo adapter to forward schain object (#21)

* wrap in if statement (#22)

* KRKPD-572: Add spec for schain (#23)

* wrap in if statement

* update test for schain, file formatting

* Adding site to Kargo adapter.

* KRKPD-619 Updating Site object.

* KRKPD-619 Adding null check for  Site object.

* Update modules/kargoBidAdapter.js

Co-authored-by: Julian Gan  <juliangan07@gmail.com>

* Reducing the size of Site object.

* remove white space that is causing linting error

* Kargo Bid Adapter: Updates to gpid retrieval

* Support for sending ortb2.user.data

---------

Co-authored-by: Julian Gan <juliangan07@gmail.com>
Co-authored-by: Neil Flynn <nflynn@kargo.com>
santii7395 pushed a commit that referenced this pull request Mar 27, 2024
* KargoBidAdapter: GPP Support

* kargo adapter to forward schain object (#21)

* wrap in if statement (#22)

* KRKPD-572: Add spec for schain (#23)

* wrap in if statement

* update test for schain, file formatting

* Adding site to Kargo adapter.

* KRKPD-619 Updating Site object.

* KRKPD-619 Adding null check for  Site object.

* Update modules/kargoBidAdapter.js

Co-authored-by: Julian Gan  <juliangan07@gmail.com>

* Reducing the size of Site object.

* remove white space that is causing linting error

* Kargo Bid Adapter: Updates to gpid retrieval

* Support for sending ortb2.user.data

* update bid Response to use actual creativeID

* update spec

* fix nomencalature based on Kargo's service

* Prebid.js - Update bid Response to use actual creativeID (#25)

* update bid Response to use actual creativeID

* update spec

* fix nomencalature based on Kargo's service

* utilize floors mod

* fixes tests

* mediatype specific floors

* simpler implementation leveraging Prebid's smart rule selection

* revert nomenclature change

* fix

* removes comment

---------

Co-authored-by: Jeremy Sadwith <jeremy@kargo.com>
Co-authored-by: Julian Gan <juliangan07@gmail.com>
Co-authored-by: Neil Flynn <nflynn@kargo.com>
Co-authored-by: “Nick <“nick.llerandi”@kargo.com>
Co-authored-by: Nick Llerandi <nick.llerandi@kargo.com>
santii7395 pushed a commit that referenced this pull request Mar 27, 2024
* create setupadBidAdapter

* add setupadBidAdapter

* update setupadBidAdapter

* update metrics collection

* update analytics collection

* update getUserSyncs

* add setupadAnalyticsAdapter.js

* test setupadAnalyticsAdapter

* remove test: 1

* add GVLID && bug fixes && test updates

* remove setupadAnalyticsAdapter

* add userID module handling

* add GVLID && bug fixes && test updates

* remove setupadAnalyticsAdapter

* add userID module handling

* clean up && seat bugfix

* clean up logs

* add userID module handling

* update md && clean up

* Send setupad only on bidRequested

* Fix bidResponse and bidWon responses

* Improve bidResponse and bidWon logic

* Revert changes to specific files

* Remove test parameter

* Fix multiple bidResponse and bidTimeout calls to getPixelUrl

* eslint errors fixes(brackets added)

* Add extra checks for events

* Fix BIDDER_CODE const

* update reporting endpoint

* update setupadBidAdapter_spec.js REPORT_ENDPOINT

* update readme

* Revert "Merge branch 'prebid:master' into setupad-adapter"

This reverts commit 1c14dbe, reversing
changes made to 7fe9ea5.

* Revert "Revert "Merge branch 'prebid:master' into setupad-adapter""

This reverts commit a34e3e4.

* # This is a combination of 20 commits.
# This is the 1st commit message:

add setupadBidAdapter

# This is the commit message #2:

update setupadBidAdapter

# This is the commit message #3:

update metrics collection

# This is the commit message #4:

update analytics collection

# This is the commit message #5:

update getUserSyncs

# This is the commit message #6:

add setupadAnalyticsAdapter.js

# This is the commit message #7:

test setupadAnalyticsAdapter

# This is the commit message #8:

remove test: 1

# This is the commit message #9:

add GVLID && bug fixes && test updates

# This is the commit message #10:

remove setupadAnalyticsAdapter

# This is the commit message #11:

add userID module handling

# This is the commit message #12:

clean up && seat bugfix

# This is the commit message #13:

add userID module handling

# This is the commit message #14:

add GVLID && bug fixes && test updates

# This is the commit message #15:

remove setupadAnalyticsAdapter

# This is the commit message #16:

add userID module handling

# This is the commit message #17:

clean up logs

# This is the commit message #18:

update md && clean up

# This is the commit message #19:

Send setupad only on bidRequested

# This is the commit message #20:

Fix bidResponse and bidWon responses

* # This is a combination of 22 commits.tree 8abae7e6dffc9a21ad11770713ba485fc610028a
parent cecfce3
author pavel <pavel@setupad.com> 1706627437 +0200
committer pavel <pavel@setupad.com> 1706627437 +0200
gpgsig -----BEGIN PGP SIGNATURE-----
 
 iQIzBAABCAAdFiEEqGYI3KX/FkbObQG8FABtd4pCs/AFAmW5EW0ACgkQFABtd4pC
 s/CK3w//WWJSFUlycnnNKTV2XfdcBjooOeZZvjpXVthwr09CCC4uO//kw4bPluhn
 f5fcVFdXzrY1AZ6ch8Wo3msX/Pkso014jIGd5aIWcHpNYFtffACwH/40Y8AcJNZd
 bsOZxVK0awPTz/RihC5eY+0J3cP+iFWP/FlYJoHEQIBXq/Eg6mWoAhxwpL/JvxbY
 QbLFWsRn2ckQ6ftOZgm3/jh8VLaG1zWbWImlWEs5Zel+CorJBTniTj58VbApelYD
 TFMgbSR2I4NGVaqNIrHePnSMsDATxalQ2nZPwY6raKCHWIbvoUPIn/OpDMMbKgC7
 nCwounNmObxFVoj3xusAZppzHpKPasY8xKWb2Kr7zfhZArsOMC6B7fYqQNK0cWG3
 8RR/10oheJD9M2kRlfLiqnRv7ExY08SQ/ZMo9LA8BeRUGBXhh6++8FKhKIHvX1gL
 k1R5W6c+NNWP+PDFsmrFpMn+LpYdl84I7yfYK5dHuw80od7f1wuAVYpswi6Cziy9
 /KY6/rfENvUrGTmWSh5GdDBel89ACCfFkasIKB92xhzKTfjzF/DXkc8XQZOMbt1j
 CsILgWMNfLPMo4Dlgdx/tYCSLLBNEtZ1/hhUcFQ3+0TzLf0GtMkvMnlBnDinqe1n
 1P30fQ2I5W5NJKDPrCOnRymI6QOAPFXtMF11R81mbB9H8asft/E=
 =oJtZ
 -----END PGP SIGNATURE-----

bugfixes

# This is the commit message #22:

Remove test parameter

* # This is a combination of 26 commits.
parent cecfce3
author pavel <pavel@setupad.com> 1706627437 +0200
committer pavel <pavel@setupad.com> 1706627437 +0200
gpgsig -----BEGIN PGP SIGNATURE-----
 
 iQIzBAABCAAdFiEEqGYI3KX/FkbObQG8FABtd4pCs/AFAmW5EW0ACgkQFABtd4pC
 s/CK3w//WWJSFUlycnnNKTV2XfdcBjooOeZZvjpXVthwr09CCC4uO//kw4bPluhn
 f5fcVFdXzrY1AZ6ch8Wo3msX/Pkso014jIGd5aIWcHpNYFtffACwH/40Y8AcJNZd
 bsOZxVK0awPTz/RihC5eY+0J3cP+iFWP/FlYJoHEQIBXq/Eg6mWoAhxwpL/JvxbY
 QbLFWsRn2ckQ6ftOZgm3/jh8VLaG1zWbWImlWEs5Zel+CorJBTniTj58VbApelYD
 TFMgbSR2I4NGVaqNIrHePnSMsDATxalQ2nZPwY6raKCHWIbvoUPIn/OpDMMbKgC7
 nCwounNmObxFVoj3xusAZppzHpKPasY8xKWb2Kr7zfhZArsOMC6B7fYqQNK0cWG3
 8RR/10oheJD9M2kRlfLiqnRv7ExY08SQ/ZMo9LA8BeRUGBXhh6++8FKhKIHvX1gL
 k1R5W6c+NNWP+PDFsmrFpMn+LpYdl84I7yfYK5dHuw80od7f1wuAVYpswi6Cziy9
 /KY6/rfENvUrGTmWSh5GdDBel89ACCfFkasIKB92xhzKTfjzF/DXkc8XQZOMbt1j
 CsILgWMNfLPMo4Dlgdx/tYCSLLBNEtZ1/hhUcFQ3+0TzLf0GtMkvMnlBnDinqe1n
 1P30fQ2I5W5NJKDPrCOnRymI6QOAPFXtMF11R81mbB9H8asft/E=
 =oJtZ
 -----END PGP SIGNATURE-----

bugfixes

# This is the commit message #22:

Remove test parameter

# This is the commit message #23:

Fix multiple bidResponse and bidTimeout calls to getPixelUrl

# This is the commit message #25:

eslint errors fixes(brackets added)

# This is the commit message #26:

Add extra checks for events

* parent 75178b9
author pavel <pavel@setupad.com> 1706627694 +0200
committer pavel <pavel@setupad.com> 1706627694 +0200
gpgsig -----BEGIN PGP SIGNATURE-----

 iQIzBAABCAAdFiEEqGYI3KX/FkbObQG8FABtd4pCs/AFAmW5Em4ACgkQFABtd4pC
 s/BBUQ/+NXyHoxPM185YJLG9M1ySC/5vTT9W5mfwQ93cVDLCeuGnpsnmi4S21NuQ
 b7gSeokFjwztvVOUmh/xqMp4lTsvL53TUd00b1k4KGVSqgcF00Foit5g8fOGLYsI
 DAoqphYV6MWjpAun+II+ELY8QUkHR1cjTc7PEGtmf+8RnptGVdyJ6C9Ab8u9TQTY
 Apj5Srhfo3Tl8S+WScOxwwB/uqEJR4fhIrJyzFzdLDEb2olSPyrQUs87vQXlhEnK
 buPEg2F5JsRH6sw11Xp3TFNSZGxNnBSlTh9dixou5md4yRCv5a2TMef667N0BVDp
 lGgc7mCrRKXyqzphmmeHudiscEGFjtUPObXoHutSVw22wdARFCTpNFKBLLFn4v8o
 Zv1OvFdNprvHsoeW0HVlZdU7OKnDTRrko6DHk2AahxojjvAFEWuDsGYZNjhdQwRR
 lK1zm+SFQnKI0Eojd+f84fvKod9geGs640jyH/x5R4eYm4yjZb8SkRtd3cca88wS
 OuGq9LIkbU428b46l7VnDwudldTXPUU8eKfUtFRjdGtIWH9I3tK6TsRoCfTcXkv0
 smxYiiU1XHjAkkPFWQWEeFdfZ071snFKVWouU0AoKiq+PdRoS8+3AJqIQUjlA2sH
 AybnSkv9KxY/Rs1bnvMubsQm1GF66qVrbxBU6FILBv1JZYwj4yA=
 =Gbog
 -----END PGP SIGNATURE-----

bugfixes

update setupadBidAdapter_spec.js REPORT_ENDPOINT

update readme

Revert "Merge branch 'prebid:master' into setupad-adapter"

This reverts commit 1c14dbe, reversing
changes made to 7fe9ea5.

Revert "Revert "Merge branch 'prebid:master' into setupad-adapter""

This reverts commit a34e3e4.

* change double quote to single quote

---------

Co-authored-by: pavel <pavel@setupad.com>
Co-authored-by: Elgars Grodnis <elgars@setupad.com>

* bugfix setupadBidAdapter

remove getAdEl, spelling correction

* add onBidWon event

onBidWon event handling moved from custom to native onBidWon method

* minor bugfixes && remove funk getSiteObj && getDeviceObj

---------

Co-authored-by: pavel <pavel@setupad.com>
Co-authored-by: Elgars Grodnis <elgars@setupad.com>
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.

5 participants