Security News
RubyGems.org Adds New Maintainer Role
RubyGems.org has added a new "maintainer" role that allows for publishing new versions of gems. This new permission type is aimed at improving security for gem owners and the service overall.
@schibsted/niche-ads
Advanced tools
This repository contains code we use for appnexus ads. Given the right config it can request and return ready to display appnexus ads. It is possible to pass configuration for ads different than appnexus but in that case you will get back your config. It was added to enable using this libary for mixed appnexus and different ads. If you don't use appnexus ads then this library is not for you!
First install dependencies clone repository, open terminal and run.
npm ci
Next start transpiling the source code:
npm run dev
Note: order of command execution is important.
In order to make your project available as package locally:
npm link
And in project you need:
npm link @schibsted/niche-ads
Since library has react
as peer dependency you need to make sure to pass react
manually to the library if you want to use linked version. The easiest way to do so is to declare react
as a webpack alias, e.g.
config.resolve.alias.react = path.resolve('./node_modules/react');
If the project you use this package in, does not have webpack, you can try https://benjaminwfox.com/blog/tech/why-isnt-npm-link-working#if-you-use-react.
And now you are all good. Your project will now use the local version of niche-ads instead of the one in node_modules.
After you end working on the package you need to unlink it.
First, in the project where the package was used:
npm unlink --no-save @schibsted/niche-ads
Second, in the niche-ads package:
npm unlink
Package exports 4 entities AdContext
, AdContextProvider
, usePlacement
, useLoadAds
.
Ideally you won't ever need to use this directly. It may be usefull for debugging or to peek what the library is storing under the hood. Ideally you should use AdContextProvider
. One thing you may find useful there is adBlockerDetectedPromise
that is a promise that resolves to a boolean and states whether we suspect that adblock was used (we weren't able to load ad script).
Ideally you should wrap your application with AdContextProvider
quite close to the start of your application.
Minimal usage example:
import { AdContextProvider } from '@schibsted/niche-ads';
function SomeComponent({ children, adsConfig, device }) {
return (
<AdContextProvider adsConfig={publicRuntimeConfig.ads} device={device}>
{children}
</AdContextProvider>
);
}
export default SomeComponent;
desktop
, tablet
, mobile
disablePsa
or enableSafeFrame
https://acdn.adnxs.com/ast/ast.js
https://cogwheel.inventory.schibsted.io/prod/latest/gdpr-bundle.js
false
false
false
glimrTags
24 * 60 * 60 * 1000
(24h)false
, waits with ad request until eids are givenSCHNO
- region of the user, either SCHNO
or SCHSE
{
options: {
member: 9700, // 9700 - regular member, 9826 - test seat
disablePsa: true,
enableSafeFrame: true,
},
placements: {
common: {
noBidIfUnsold: true, // will be passed to all placements
},
desktop: {
other: [ // different type of pages, usually article, front and other are used
{
targetId: 'advert-topboard',
invCode: 'no-pent-wde-other_topboard',
sizes: [
[1010, 300],
[1010, 150],
[980, 300],
[980, 150],
[1000, 150],
],
alwaysUseXDomainIframe: true,
keywords: {
'no-sno-adformat': 'topboard',
},
},
],
},
tablet: {
other: [
{
targetId: 'advert-topboard',
invCode: 'no-pent-wtb-other_topboard',
sizes: [
[980, 300],
[980, 250],
[768, 250],
],
keywords: {
'no-sno-adformat': 'topboard',
},
},
],
},
mobile: {
other: [
{
targetId: 'advert-board_1',
invCode: 'no-pent-wph-front_board_1',
sizes: [
[320, 250],
[300, 250],
[320, 400],
],
keywords: {
'no-sno-adformat': 'board_1',
},
},
],
},
},
keywords: {
common: {
'aa-sch-country_code': 'no',
'aa-sch-publisher': 'pent',
'no-sno-publishergroup': 'schibsted',
'aa-sch-inventory_type': 'other',
'aa-sch-page_type': 'other',
},
desktop: {
common: {
'aa-sch-supply_type': 'web_desktop',
},
},
tablet: {
common: {
'aa-sch-supply_type': 'web_tablet',
},
},
mobile: {
common: {
'aa-sch-supply_type': 'web_phone',
},
},
},
}
setWallpaperFunction
const setWallpaper = (url) => {
document.body.style.backgroundImage = `url(${url})`;
document.body.style.backgroundRepeat = 'no-repeat';
document.body.style.backgroundAttachment = 'fixed';
};
setBackgroundColour
export const setBackgroundColour = (colour) => {
document.body.style.backgroundColor = colour;
};
Xandr now accepts pulse identifiers, to set them you will have to call ppids
event on adsEventTarget
with {PPID1, PPID2}
object in details. You can do it like this:
const [PPID1, PPID2] = await Promise.all([pulseInstance.getXandrPPID1(), pulseInstance.getXandrPPID2()]);
adsEventTarget.dispatchEvent(new CustomEvent('ppids', { detail: { PPID1, PPID2 } }));
To check if they are working you can look for eids
property in request for ads.
FAQs
Package containing ads logic reappearing across our projects
The npm package @schibsted/niche-ads receives a total of 1 weekly downloads. As such, @schibsted/niche-ads popularity was classified as not popular.
We found that @schibsted/niche-ads demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
RubyGems.org has added a new "maintainer" role that allows for publishing new versions of gems. This new permission type is aimed at improving security for gem owners and the service overall.
Security News
Node.js will be enforcing stricter semver-major PR policies a month before major releases to enhance stability and ensure reliable release candidates.
Security News
Research
Socket's threat research team has detected five malicious npm packages targeting Roblox developers, deploying malware to steal credentials and personal data.