Coder Social home page Coder Social logo

washingtonpost / arcads Goto Github PK

View Code? Open in Web Editor NEW
56.0 20.0 40.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 Introduction

ArcAds

CircleCI

ArcAds is a GPT (Google Publisher Tag) wrapper created by Arc XP. Using ArcAds you can make use of many GPT features such as size mapping, refreshing, and targeting. In addition you can also make use of header bidding vendors such as Prebid.js and Amazon A9/TAM by using the appropriate configuration.

Getting Started

To get started you must include the script tag for ArcAds in your page header, located here. You can also optionally run npm install followed by npm run build to compile it yourself in case you need to make any modifications. Once included you can initialize the ArcAds wrapper class like so in your page header.

<script src="path/to/arcads.js"></script>

<script type="text/javascript">
  const arcAds = new ArcAds({
    dfp: {
      id: '123',
      collapseEmptyDivs: true
    }
  })
</script>

collapseEmptyDivs is an optional parameter that directly toggles googletag.pubads().collapseEmptyDivs()

Alternatively, if you're using a bundler you can use the library as a module.

npm install arcads 

You can then include it in your own JavaScript projects like so.

import { ArcAds } from 'arcads'

Displaying an Advertisement

You can display an advertisement by calling the registerAd method, this can be called as many times and wherever you'd like as required.

arcAds.registerAd({
  id: 'div-id-123',
  slotName: 'hp/hp-1',
  dimensions: [[300, 250], [300, 600]],
  display: 'desktop'
})

Along with the registerAd call you also need a div on the page with the same id.

<div id="div-id-123"></div>

If you are using an external service to manage initial ad load (like Didomi), set window.blockArcAdsLoad = true on page load to block ArcAds from refreshing ads. Set window.blockArcAdsLoad = false when you want ArcAds to control refreshing ads again.

The following table shows all of the possible parameters the registerAd method accepts.

Parameter Description Type Requirement
id The id parameter corresponds to a div id on the page that the advertisement should render into. String Required
slotName The slotName parameter is equal to the slot name configured within GPT, for example sitename/hp/hp-1. The publisher ID gets attached to the slot name within the ArcAds logic. String Required
dimensions The dimensions parameter should be an array with array of arrays containing the advertisement sizes the slot can load. If left empty the advertisement will be considered as an out of page unit. Array Optional
adType The adType parameter should describe the type of advertisement, for instance leaderboard or cube. String Optional
display The display parameter determines which user agents can render the advertisement. The available choices are desktop, mobile, or all. If a value is not provided it will default to all. String Optional
targeting The targeting parameter accepts an object containing key/value pairs which should attached to the advertisement request. Object Optional
sizemap The sizemap parameter accepts an object containing information about the advertisements size mapping, for more information refer to the Size Mapping portion of the readme. Object Optional
bidding The bidding parameter accepts an object containing information about the advertisements header bidding vendors, for more information refer to the Header Bidding portion of the readme. Object Optional
prerender The prerender parameter accepts an a function that should fire before the advertisement loads, for more information refer to the Prerender Hook portion of the readme. Function Optional

Out of Page Ads

If an advertisement has an empty or missing dimensions parameter it will be considered as a GPT Out of Page creative and rendered as such.

Callback

Whenever an advertisement loads you can access data about the advertisement such as its size and id by passing in an optional callback to the initialization of ArcAds. This ties a handler to the slotRenderEnded event that GPT emits and is called every time an advertisement is about to render, allowing you to make any page layout modifications to accommodate a specific advertisement.

const arcAds = new ArcAds({
  dfp: {
    id: '123'
  }
}, (event) => {
  console.log('Advertisement has loaded...', event)
})

Refreshing an Advertisement

If you require the ability to refresh a specific advertisement you can do so via the googletag library, providing it the slot object from GPT. You can get access to the slot object in the callback of ArcAds via event.slot.

const arcAds = new ArcAds({
  dfp: {
    id: '123'
  }
}, (event) => {
  window.adSlot = event.slot
})

// Refresh a single ad slot
window.googletag.pubads().refresh([window.adSlot])

// Refresh all ad slots on the page
window.googletag.pubads().refresh()

Targeting

Advertisement targeting parameters can be passed to the registration call via the targeting object.

arcAds.registerAd({
  id: 'div-id-123',
  slotName: 'hp/hp-1',
  adType: 'cube',
  dimensions: [[300, 250], [300, 600]],
  display: 'all',
  targeting: {
    section: 'weather'
  }
})

The service will automatically give the advertisement a position target key/value pair if either the targeting object or position key of the targeting object are not present. The position value will increment by 1 in sequence for each of the same adType on the page. This is a common practice between ad traffickers so this behavior is baked in, only if the trafficker makes use of this targeting will it have any effect on the advertisement rendering.

If adType is excluded from the registerAd call the automatic position targeting will not be included.

Size Mapping

You can configure GPT size mapped ads with the same registration call by adding a sizemap object. To utilize size mapping the dimensions key should be updated to include an array representing a nested array of arrays containing the applicable sizes for a specific breakpoint.

[ [[970, 250], [970, 90], [728, 90]],
  [[728, 90]],
  [[320, 100], [320, 50]] ]

Followed by an array of equal lengths of breakpoints which will sit within sizemap.breakpoints.

[ [1280, 0], [800, 0], [0, 0] ]

When put together this will mean that at a window width of 1280 wide, the service can load a 970x250, 970x90 or a 728x90 advertisement. At 800 wide, it can load a 728x90, and anything below 800 it will load a 320x90 or a 320x50.

If the advertisement should refresh dynamically when the user resizes the screen after the initial load you can toggle refresh to true. otherwise it should be false.

arcAds.registerAd({
  id: 'div-id-123',
  slotName: 'hp/hp-1',
  adType: 'cube',
  dimensions: [ [[970, 250], [970, 90], [728, 90]], [[728, 90]], [[320, 100], [320, 50]] ],
  targeting: {
    section: 'weather'
  },
  sizemap: {
    breakpoints: [ [1280, 0], [800, 0], [0, 0] ],
    refresh: true
  }
})

Prerender Hook

ArcAds provides a way for you to get information about an advertisement before it loads, which is useful for attaching targeting data from third party vendors.

You can setup a function within the registerAd call by adding a prerender parameter, the value of which being the function you'd like to fire before the advertisement loads. This function will also fire before the advertisement refreshes if you're using sizemapping.

arcAds.registerAd({
  id: 'div-id-123',
  slotName: 'hp/hp-1',
  dimensions: [[300, 250], [300, 600]],
  display: 'desktop',
  prerender: window.adFunction
})

Your prerender function must return a promise. Once it's resolved the advertisement will display. If you do not resolve the promise the advertisement will not render.

window.adFunction = function(ad) {
  return new Promise(function(resolve, reject) {
    // The 'ad' argument will provide information about the unit
    console.log(ad)
    // If you do not resolve the promise the advertisement will not display
    resolve()
  });
}

You can gather information about the advertisement by accessing the ad argument/object.

Key Description
adUnit An object containing the GPT ad slot. This can be used when calling other GPT methods.
adSlot Contains a string with the full slot name of the advertisement.
adDimensions Contains an array with the size of the advertisement which is about to load.
adId Contains a string with the id of the advertisement.

For a more detailed example of how to utilize this functionality please see the wiki.

Header Bidding

ArcAds supports Prebid.js and Amazon TAM/A9. To enable these services you must first enable them when you configure the wrapper.

Prebid.js

If you'd like to include Prebid.js you must include the library before arcads.js. You can get a customized version of Prebid.js with the adapters your site needs from their website here.

<script src="path/to/prebid.js"></script>
<script src="path/to/arcads.js"></script>

<script type="text/javascript">
  const arcAds = new ArcAds({
    dfp: {
      id: '123'
    }, 
    bidding: {
      prebid: {
        enabled: true
      }
    }
  })
</script>

You can enable Prebid.js on the wrapper by adding a prebid object to the wrapper initialization and setting enabled: true. If enabled is undefined, prebid can still be used by providing a valid bids object. You can also optionally pass it a timeout value which corresponds in milliseconds how long Prebid.js will wait until it closes out the bidding for the advertisements on the page. By default, the timeout will be set to 700.

const arcAds = new ArcAds({
  dfp: {
    id: '123'
  },
  bidding: {
    prebid: {
      enabled: true,
      timeout: 1000
    }
  }
}

If you want to use the slotName instead of the ad id when registering ads, pass useSlotForAdUnit: true.

const arcAds = new ArcAds({
  dfp: {
    id: '123'
  },
  bidding: {
    prebid: {
      enabled: true,
      timeout: 1000,
      useSlotForAdUnit: true
    }
  }
}

On the wrapper you can also configure a size mapping configuration, which will provide information to Prebid.js on which sized advertisements it should fetch bids for on each breakpoint. For more information on what needs to be configured within the sizeConfig array click here.

const arcAds = new ArcAds({
  dfp: {
    id: '123'
  },
  bidding: {
    prebid: {
      enabled: true,
      timeout: 1000,
      sizeConfig: [
        {
          'mediaQuery': '(min-width: 1024px)',
          'sizesSupported': [
            [970, 250],
            [970, 90],
            [728, 90]
          ],
          'labels': ['desktop']
        }, 
        {
          'mediaQuery': '(min-width: 480px) and (max-width: 1023px)',
          'sizesSupported': [
            [728, 90]
          ],
          'labels': ['tablet']
        }, 
        {
          'mediaQuery': '(min-width: 0px)',
          'sizesSupported': [
            [320, 100],
            [320, 50]
          ],
          'labels': ['phone']
        }
      ]
    }
  }
})

On the advertisement registration you can then provide information about which bidding services that specific advertisement should use. You can find a list of parameters that Prebid.js accepts for each adapter on the Prebid.js website. Additionally you can turn on Prebid.js debugging by adding ?pbjs_debug=true to the url.

arcAds.registerAd({
  id: 'div-id-123',
  slotName: 'hp/hp-1',
  adType: 'cube',
  display: 'desktop',
  dimensions: [ [[970, 250], [970, 90], [728, 90]], [[728, 90]], [[320, 100], [320, 50]] ],
  sizemap: {
    breakpoints: [ [1280, 0], [800, 0], [0, 0] ],
    refresh: 'true'
  },
  bidding: {
    prebid: {
      enabled: true,
      bids: [{
        bidder: 'appnexus',
        labels: ['desktop', 'tablet', 'phone'],
        params: {
          placementId: '10433394' 
        }
      }]
    }
  }
})

Amazon TAM/A9

You can enable Amazon A9/TAM on the service by adding an amazon object to the wrapper initialization and then passing it enabled: true. You must also include the apstag script on your page with:

<script src="https://c.amazon-adsystem.com/aax2/apstag.js"></script>

You must also provide your publication id that corresponds to the owners Amazon account.

const arcAds = new ArcAds({
  dfp: {
    id: '123'
  },
  bidding: {
    amazon: {
      enabled: true,
      id: '123'
    }
  }
})

On the advertisement registration you simply provide enabled: true for the specific advertisement within the bidding object. There are no additional properties which are required.

arcAds.registerAd({
  id: 'div-id-123',
  slotName: 'hp/hp-1',
  adType: 'cube',
  display: 'desktop',
  dimensions: '[ [[970, 250], [970, 90], [728, 90]], [[728, 90]], [[320, 100], [320, 50]] ]',
  sizemap: {
    breakpoints: '[ [1280, 0], [800, 0], [0, 0] ]',
    refresh: 'true'
  },
  bidding: {
    amazon: {
      enabled: true
    }
  }
})

NOTE: Currently Amazon A9/TAM is not supported for use with Singe Request Architecture (SRA).

Registering Multiple Ads

You can display multiple ads at once using the registerAdCollection method. This is useful if you're initializing multiple advertisements at once in the page header. To do this you can pass an array of advertisement objects similar to the one you would with the registerAd call. Note that when using this function, if setAdsBlockGate() has not been called, the calls for each ad will be made individually. If you need to achieve Single Request Architecture, see the documentation below, "SRA Single Request Architecture".

const ads = [{
    id: 'div-id-123',
    slotName: 'hp/hp-1',
    adType: 'cube',
    display: 'desktop',
    dimensions: '[ [[970, 250], [970, 90], [728, 90]], [[728, 90]], [[320, 100], [320, 50]] ]',
    sizemap: {
      breakpoints: '[ [1280, 0], [800, 0], [0, 0] ]',
      refresh: 'true'
    },
    bidding: {
      prebid: {
        enabled: true,
        bids: [{
          bidder: 'appnexus',
          labels: ['desktop', 'tablet', 'phone'],
          params: {
            placementId: '10433394' 
          }
        }]
      }
  },
  {
    id: 'div-id-456',
    slotName: 'hp/hp-2',
    adType: 'square',
    display: 'mobile',
    dimensions: '[ [300, 250], [300, 600] ]',
    bidding: {
      prebid: {
        enabled: true,
        bids: [{
          bidder: 'appnexus',
          labels: ['desktop', 'tablet', 'phone'],
          params: {
            placementId: '10433394' 
          }
        }]
      }
  }
]


arcAds.registerAdCollection(ads)

SRA Single Request Architecture

SRA architecture Functions will allow all ads to go out in one single ad call. The functions are presented in the order they should be called:

  1. setPageLevelTargeting(key, value): sets targeting parameters- applied to all ads on the page. Extracting common targeting values is recommended in order to avoid repeating targeting for each ad in the single ad call.
  2. setAdsBlockGate(): “closes” the gate - as ads are added, calls do not go out. This allows ads configurations to accumulated to be set out later, together all at once.
  3. reserveAd(params): accumulates ads to be sent out later. This function is called once per one ad.
  4. releaseAdsBlockGate(): “opens” the gate - allows an ad call to go out.
  5. sendSingleCallAds(): registers all the ads added via reserveAd(), and sends out a single ad call (SRA call) containing all the ads information that has been added so far via reserveAd().

To add more ads, repeat steps 1-5 as needed.

NOTE: Prebid is supported for SRA. Amazon A9/TAM is not supported for SRA and will need to be implemented at a future date.

NOTE: ArcAds SRA implementation calls enableSingleRequest() which means that when using pubads lazyLoad functions together with SRA, when the first ad slot comes within the viewport specified by the fetchMarginPercent parameter, the call for that ad and all other ad slots is made. If different behavior is desired after the initial SRA call is made, an outside lazy loading library may be used to manage the calls for registerAd, reserveAd and other calls.

Developer Tools

There's a series developer tools available, to get started run npm install.

Command Description
npm run dev Runs the development command, watches for changes and compiles the changes down to the dist directory.
npm run build Builds the project into the dist directory with minification.
npm run docs Generates ESDoc documentation in the docs directory on-demand.
npm run test Runs a series of unit tests with Jest. Tests are automatically validated during a pull request.
npm run debug Starts a local http server so you can link directly to the script during development. For example `<script src="http://localhost:9000/dist/arcads.js"></script>

Slot Override

You can override the slot name of every advertisement on the page by appending ?adslot= to the URL. This will override whatever is placed inside of the slotName field when invoking the registerAd method. For example, if you hit the URL arcpublishing.com/?adslot=homepage/myad, the full ad slot path will end up being your GPT id followed by the value: 123/homepage/myad.

You can also debug slot names and GPT in general by typing window.googletag.openConsole() into the browsers developer console.

Logging

To inspect the function calls taking place within the ArcAds library, you can include the debug=true query parameter on your page.

Contributing

If you'd like to contribute to ArcAds please read our contributing guide.

arcads's People

Contributors

badmintonkid avatar design1online avatar ecarlisle avatar evanbret avatar hirethisdeveloper avatar jakma avatar jamesives avatar jgrosspietsch avatar kalanchoej avatar kant avatar maddoxnelson avatar nealmalkani avatar omonoukpoma avatar rachelpost avatar yonm avatar

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

NPM version

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

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.

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.

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.

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

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.

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

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

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

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.

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.

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.

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.

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.

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?

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.

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.