Skip to content
This repository has been archived by the owner on Mar 25, 2024. It is now read-only.

ZTB-1709: disable video (round 1) #5

Merged
merged 2 commits into from
Jan 10, 2023
Merged

Conversation

mbcrute
Copy link

@mbcrute mbcrute commented Jan 9, 2023

TL; DR

These were some very boring files as there was very little code specific to video ads to be found. I took some notes on some things I found while combing through the files in ZTB-1709 which I'll include below.

Size before this ticket Size after this ticket Difference?
284,989 284,899 -90

Renderer.js

This file is intended to be used for providing a custom video renderer for outstream video ads which (in theory) means that you could drop it entirely from the Prebid build if you had no interest in supporting video ads. However, after the initial implementation of outstream video ad support, this feature was extended so that consumers of Prebid could provide a custom renderer for any type of ad (see issue #3231) making it not terribly reasonable or feasible to remove Renderer.js entirely.

There is one line in the file that is specific to video:

// renderer defined at adUnit.mediaTypes level
const mediaTypeRenderer = deepAccess(adUnit, 'mediaTypes.video.renderer');

I am legitimately unsure whether or not this is a bug. 3231 specifically states that Renderer should support multi-format ad units so I am suspicious that the hard-coding of mediaTypes.video here is a bug.

The rest of the code in this file is pretty media type agnostic so assuming it's still true that custom renderers can be specified on a per media type basis there doesn't seem to be any work to be done in this file.

adServerManager.js

This file exports one function: registerVideoAdSupport(name, videoSupport) and according to its JSDoc:

/**
* This file defines the plugin points in prebid-core for AdServer-specific functionality.
*
* Its main job is to expose functions for AdServer modules to append functionality to the Prebid public API.
* For a given Ad Server with name "adServerName", these functions will only change the API in the
* $$PREBID_GLOBAL$$.adServers[adServerName] namespace.
*/

So it's an API for third party modules to extend the Prebid global. It's only usages are in third party modules (modules/adlooxAdServerVideo.js, modules/konduitWrapper.js, etc.) so that checks out.

Since ES6 imports & exports must be static you can't just wrap the function declaration in a conditional; the best you could do is wrap the entire body of the function in an if (FEATURES.VIDEO) conditional, thus turning registerVideoSupport into a noop if the feature were turned off. This would remove about 8 lines of code from the build: not nothing, but not much.

A better solution is to leave this file alone and wrap its invocations in the modules folder in conditionals:

if (FEATURES.VIDEO) {
  registerVideoSupport('adloox', {
    buildVideoUrl: buildVideoUrl
  });
}

Doing so should result in all invocations of the function being dropped from the final build. The exported function from adServerManager.js will then be flagged as an unused export making it subject to tree shaking.

But does it...?

Yes! When building with only the adlooxAdServerVideo module included and video disabled there is a noticeable difference in the resulting bundle size:

if (FEATURES.VIDEO) conditional around call to to registerVideoSupport? Bundle Size on Disk
No 161,212
Yes 157, 281

So leaving adServerManager.js alone and wrapping 3 lines in adlooxServerVideo.js in a conditional saved a whopping 3,931 bytes. Not too shabby.

Analyzed the following files looking for video-specific code:

- Renderer.js
- adRendering.js
- adServerManager.js
- adUnits.js
- adapter.js
- adapterManager.js
- adloader.js
- adserver.js

Found a few lines in `adapterManager.js`. Fixed associated broken tests.
@mbcrute mbcrute self-assigned this Jan 9, 2023
@mbcrute mbcrute merged commit 85c8be6 into ZTB-1708__Disable-Video Jan 10, 2023
@mbcrute mbcrute deleted the ZTB-1709 branch January 17, 2023 17:13
mbcrute pushed a commit that referenced this pull request Mar 30, 2023
…populate imp-level `ext.tid` (prebid#9726)

* RTBHouse Bid Adapter: add global vendor list id

* structured user agent - browsers.brands

* fix lint errors

* Added sda into rtbhouse adapter

* spreading ortb2: user & site props

* examples reverted

* init version

* using mergedeep

* removed wrong imp array augm.; slot imp augm. with addtl check

* [SUA] merging ortb2.device into request

* fledge auctionConfig adapted to our bid response structure

* new bidder response structure for fledge

* make sure bidderRequest has proper flag turned on

* fledge endpoint hardcoded; code cleanups

* remove obsolete function

* obsolete function removed

* [RTB House] Process FLEDGE request/response (#4)

* [SDA & SUA] refactor using mergedeep

* [FLEDGE] fledge auctionConfig adapted to our bid response structure

* [FLEDGE] new bidder response structure for fledge

* [FLEDGE] make sure bidderRequest has proper flag turned on

* [FLEDGE] fledge endpoint hardcoded; code cleanups

* [FLEDGE] remove obsolete functions

* fixed lint errors

* fledge test suites; adapter: delete imp.ext.ae when no fledge (#5)

* RTBHouse Bid Adapter: use auctionId for source.tid

* RTBHouse bid adapter: fixed source.tid tests

* Imp level transaction id + mapSource fix

* lint: removed obsolete whitespaces

* RTBHouse Bid Adapter: change `source.tid` to contain `auctionId` and populate imp-level `ext.tid` (#8)

* RTBHouse Bid Adapter: use auctionId for source.tid

* Imp level transaction id + mapSource fix

* lint: removed obsolete whitespaces

---------

Co-authored-by: Leandro Otani <leandro.otani@rtbhouse.com>
Co-authored-by: rtbh-lotani <83652735+rtbh-lotani@users.noreply.github.com>
Co-authored-by: Tomasz Swirski <tomasz.swirski@rtbhouse.com>
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants