GithubHelp home page GithubHelp logo

washingtonpost / arcads Goto Github PK

View Code? Open in Web Editor NEW
56.0 20.0 42.0 2.03 MB

ArcAds is a DFP wrapper created by Arc XP with publishers in mind.

Home Page: https://www.npmjs.com/package/arcads

License: MIT License

JavaScript 100.00%
advertising dfp prebid a9 amazon header-bidding doubleclick library

arcads's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

arcads's Issues

How to map the size from dimensions to sizes[] for prebid.js

I am trying to setup a demo page with the sample from prebid.org. Here's the code snippet I am using:

arcAds.registerAd({
    id: 'div-1',
    slotName: 'header-bid-tag-0',
    adType: 'leaderboard',
    display: 'all',
    dimensions: '[[970, 250], [970, 90], [728, 90]]',
    sizemap: {
        breakpoints: '[ [1280, 0] ]',
        // refresh: 'leaderboard'
    },
    bidding: {
        prebid: {
            enabled: true,
            bids: [{
                bidder: 'appnexus',
                labels: ['desktop'],
                params: {
                    placementId: '13144370'
                }
            }]
        }
    }
})

Expected Behavior

Receive the bid from the auction request.

Actual Behavior

The auction failed with a {"error":"parse"} message.

Steps to Reproduce the Behavior

Looking into the bid request, you'll see the sizes[] from the payload is empty:

{
    "tags": [{
        "sizes": [],
        "ad_types": ["banner"],
        "uuid": "275015f90ea6f6",
        "id": 13144370,
        "allow_smaller_sizes": false,
        "use_pmt_rule": false,
        "prebid": true,
        "disable_psa": true
    }],
    "sdk": {
        "source": "pbjs",
        "version": "1.15.0"
    }
}

Additional Comments

Is there anything I've missed from the code? Or set the sizemap incorrectly?
Thank you so much for sharing the project. Any help would be appreciated.

Security Vulnerability report requiring manual review with esdoc > minimist

Expected Behavior

  • No security warnings
  • Ability to upgrade automatically the dependency via npm audit fix

Actual Behavior

────────────────────────────────────────────────┐
│                                Manual Review                                 │
│            Some vulnerabilities require your attention to resolve            │
│                                                                              │
│         Visit https://go.npm.me/audit-guide for additional guidance          │
└──────────────────────────────────────────────────────────────────────────────┘
┌───────────────┬──────────────────────────────────────────────────────────────┐
│ Moderate      │ Regular Expression Denial of Service                         │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Package       │ marked                                                       │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Patched in    │ >=0.6.2                                                      │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Dependency of │ arcads                                                       │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Path          │ arcads > esdoc > marked                                      │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ More info     │ https://npmjs.com/advisories/812                             │
└───────────────┴──────────────────────────────────────────────────────────────┘
┌───────────────┬──────────────────────────────────────────────────────────────┐
│ Moderate      │ Regular Expression Denial of Service                         │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Package       │ marked                                                       │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Patched in    │ >=0.6.2                                                      │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Dependency of │ arcads                                                       │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Path          │ arcads > esdoc-standard-plugin > esdoc-publish-html-plugin > │
│               │ marked                                                       │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ More info     │ https://npmjs.com/advisories/812                             │
└───────────────┴──────────────────────────────────────────────────────────────┘
┌───────────────┬──────────────────────────────────────────────────────────────┐
│ Low           │ Prototype Pollution                                          │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Package       │ minimist                                                     │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Patched in    │ >=0.2.1 <1.0.0 || >=1.2.3                                    │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Dependency of │ arcads                                                       │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Path          │ arcads > esdoc > minimist                                    │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ More info     │ https://npmjs.com/advisories/1179                            │
└───────────────┴──────────────────────────────────────────────────────

Steps to Reproduce the Behavior

  • npm audit or yarn audit

https://www.npmjs.com/advisories/1179

Additional Comments

  • I bet dependabot has suggested this?

Collapse Empty Divs for inline ad

Expected Behavior

  • collapse empty div behavior for inline ad

Actual Behavior

  • empty div is collapse

Steps to Reproduce the Behavior

ArcAds library has ability to accept configs for collapseEmptyDiv but that collapse only happens at the interior div level - APD repo has to add padding at a parent container level and collapseEmptyDiv doesn't collapse at the parent arcAds component level so if an ad is empty even tho it does collapse at the interior dev arcAds level it does not at that parent container arcAds component level. For that case the padding is still seen even tho there is no ad. Is this an option we can include for arcAds? hiding/collapsing of any parent component divs/ids/classes perhaps?

Additional Comments

Reference to PR for https://github.com/wapopartners/AppleDaily-PageBuilder-Fusion-Features/pull/697

Feature request: Ability to override ad unit with adzone parameter for testing purposes

User story
As a developer, I want to be able to consistently see certain problematic ads in my local environment, so that I can debug issues reported with them

As an adops manager, I want to be able to visualize how a page will look with a certain ad campaign, so that I can show it to potential clients

Context
We've implemented this functionality for Arc clients before and I think it would be useful for any user of ArcAds. Essentially, if the parameter ?adzone is added to a URL, we replace the ad unit that would normally be on the page (what is in slotName in ArcAds)with the value of the parameter. For example, http://www.website.com/?adzone=test/arc would replace an ad unit that's normally on this page (e.g. homepage) with the value in the parameter (test/arc).

Adops team can target specific ads only to this this ad unit, if there are issues that need to be addressed with certain ad types. This helps the developers not have to spend time searching for pages that have a particular ad targeted to them.

Arc partners have also found it helpful to be able to show an advertising client how their campaign will look. They can set up a test ad unit like test/client-name and show what the homepage will look like with all the creatives in that vendor's campaign, for example.

Acceptance criteria

  1. If the parameter adzone is included in a URL, the value of that parameter should replace the ad unit path that we normally would use for the page.
  2. The DFP Network Code (aka publisher ID) should not be replaced – this should stay as-is. Just the part that follows should be replaced.
  3. This should apply to all DFP ad calls that are constructed with ArcAds – including banner ads, preroll, out-of-page.

Lazyloading?

Expected Behavior

I'm hoping to learn if you've thought about incorporating lazy loading into this library. Perhaps with IntersectionObserver?

Actual Behavior

Currently all of the ads load when the page loads.

KV Pairs through a query param

Something that has been requested is the ability to configure a KV pair through a query parameter for ad slot targeting. For instance this might look something like ?kv=weather/hot which will send a targeting parameter to all DFP ads of thing and other. This can be used for social referrals to prevent/cause the display of certain ads.

Pass additional data to pbjs.setConfig and pbjs.bidderSettings

Hi all,
I need to add on prebidjs call some additional params:

pbjs.bidderSettings = {
   onetag:{
      bidCpmAdjustment:function(bidCpm, bid){
          return bidCpm * 0.9;
      }
   },
   criteo:{
      bidCpmAdjustment:function(bidCpm, bid){
          return bidCpm * 1;
      }
   },
};

And:

pbjs.setConfig({
      currency: currencyConfig,
      priceGranularity: granularityConfig,
      consentManagement: iabConfig,
      schain: sChainConfig,
      userSync: userSyncConfig,
   });

Where i can integrate this portions of code correctly? (if it's possibile).

Thanks a lot.

Add ability to request non-personalized ads

Expected Behavior

An option for dfp to request non-personalized ads via setRequestNonPersonalizedAds gpt option

Actual Behavior

No option available for non-personalized ads

Additional Comments

This is very important for European publishers to be GDPR compliant

Single request not working as expected

Expected Behavior

Single request to ask for every slot in the page

Actual Behavior

One request to GPT for each slot in the page

Steps to Reproduce the Behavior

I have an array of slots:

const ads = [];
slots.forEach(slot => {
    ads.push(
      {
        id: slot.id,
        slotName: slot.name,
        dimensions: slot.sizes,
      }
    );
  });
arcads.registerAdCollection(ads);

This generates 1 request for each slot in the slots collection.

Resize event fires without resizing past a breakpoint

Hi,

I'm with CMG and I've noticed the following bug with ArcAds that is impacting ads revenue for us.

Expected Behavior

The resize based fetchBids/refreshSlot requests should trigger only when the page is resized beyond a breakpoint.

Actual Behavior

The resize based fetchBids/refreshSlot requests are triggered on first resize event on the page regardless of window width (Sometimes the resize event is triggered by the browser on page load, without any actual change in the window's width, however, this is not an ArcAds bug, but it certainly exacerbates the ArcAds bug described).

Steps to Reproduce the Behavior in Chrome

  1. Ensure all ad blocking plugins are disabled.
  2. Open the Network tab and monitor ad requests by filtering for /gampad.+hp01/ for the HP01 slot or any other slot on the page.
  3. With the Network tab open, visit https://www.wsbtv.com/.
  4. Note that there are two requests made after page fully loads.
  5. If you trace the second request, it's originated in the sizemapping logic

Additional Comments

When a user resizes the window's width for the first time after page load, the callback produced by runResizeEvents should only fire if the width change is past a breakpoint, as described in the docs for the function:

Resize event that checks if a user has resized past a breakpoint included in the advertisements sizemap.

However, because the initial value of lastBreakpoint is undefined, then the lastBreakpoint !== breakpoint condition is satisfied as well as (width > breakpoint && (width < nextBreakpoint || !nextBreakpoint) for one breakpoint in [0, 768, 1024] on this line.

As a result fetchBids/refreshSlot is triggered unnecessarily leading to unnecessary ad requests for each ad slot.

Note that once lastBreakpoint is set after the initial call, this incorrect behavior goes away.

But to make matters worse, some desktop browsers trigger a resize event on the window after page load and because runResizeEvents is added to the window's resize EventListener, all ad slot requests are doubled, once on page load, and once on the subsequent unexpected resize event on the window that follows.

I have created the following Pull Request to address the issue: #83.

Please advise on how we should proceed.

NPM version

It would be ideal if we had an NPM version with the latest build from master.

Collapsing empty div elements

Expected Behavior

When ad slots don't get filled, the empty divs should collapse by default.

Actual Behavior

Divs that are used by ads slots that don't get filled, do not collapse. These divs introduce blank spaces in the layout.

Steps to Reproduce the Behavior

Catch an ad slot that does not deliver creative, or schedule a slot to deliver an empty creative.

Additional Comments

Further details for implementation can be found here:
https://support.google.com/admanager/answer/3072674?hl=en

Desired default behavior for instances when ad slots get filled most of the time:
Add googletag.pubads().collapseEmptyDivs(); to the portion of your page to collapse a particular div only when an ad doesn't serve to its ad slot. If a slot isn't filled, the div collapses, possibly moving the page content up with it and reflowing the page.

Error Fetch Prebid

The ad Unit Properties only use

  • code
  • sizes
  • bids
  • mediaTypes
  • labelAny
  • labelAll

but send:

const adInfo = {
adUnit: ad,
adSlot: slotName,
adDimensions: dimensions,
adId: id,
bids: bidding,
};

queuePrebidCommand.bind(this, fetchPrebidBids(ad, wrapper.prebid.useSlotForAdUnit ? slotName : id, timeout, adInfo, prerender, () => {

pbjs.addAdUnits(info); //eslint-disable-line no-undef

Problem with cloned dist/arcads.js

So i cloned the the code and made some modifications in gpt.js and index.js but when i compiled the arcads.js did not work, I also tried to reclone and without modifications tried some basic ArcAds code but the arcads.js still did not respond. I know the code i wrote works because i copy pasted arcads.js from this git but not when i cloned it. I have a hard time understanding how i can make it work, could i be missing something? Would be very helpful if someone could help.

a vulnerability CVE-2021-33587 is introduced in arcads

Hi, @nealmalkaniwapo, a vulnerability CVE-2021-33587 is introduced in arcads via:
[email protected][email protected][email protected][email protected][email protected]

However, esdoc is a legacy package, which has not been maintained for about 2 years.
Is it possible to migrate esdoc to other package to remediate this vulnerability?

I noticed a migration record in other js repo for esdoc:

● in crest2d, version 1.1.2, migrated from esdoc to jsdoc via commit
● in wootils, version 3.0.4, migrated from esdoc to jsdoc via commit

Are there any efforts planned that would remediate this vulnerability or migrate esdoc?

Thanks.

Test Coverage Improvements

As ArcAds spins into open source we'd like to increase its test coverage over all. We should be testing the library with mock ad calls to ensure that they are being created correctly. I'm going to leave this as an open issue for discussion as I figure out what direction this needs to take.

Ad refreshing

Hello,
I'd like to refresh ads each 30 seconds with a new bid each time.
Is there a way do to so without forking the module ?

Thanks

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.