Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@advertol/service-google-dfp

Package Overview
Dependencies
Maintainers
1
Versions
10
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@advertol/service-google-dfp

Google DFP/Ad Manager service.

  • 1.2.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

@advertol/service-google-dfp

Build Status BrowserStack Status

Google DFP/Ad Manager service.

Install

npm install @advertol/service-google-dfp --save

Usage

<!doctype html>
<html>
	<head>
		<script async="async" src="https://www.googletagservices.com/tag/js/gpt.js"></script>
		<script>
			window.googletag = window.googletag || {};
			window.googletag.cmd = window.googletag.cmd || [];
		</script>
	</head>
	<body>
		<div id="zone-becky"></div>
	</body>
</html>
import advertol from '@advertol/core';
import GoogleDfpService from '@advertol/service-google-dfp';

const instance = advertol({
	// …
	service: [
		new GoogleDfpService({
			zones: [{
				id: 'becky',
				adUnitPath: '/42/becky',
				slot: () => window.googletag.defineSlot('/42/becky', ['fluid'], 'zone-becky').addService(window.googletag.pubads())
			}]
		})
	]
});

instance.resolve();

API

googleDfpService({ zones, onSetup, refreshZones })

zones

Type: Object[]

List of zones with their slot callback.

PropertyTypeDescription
slotFunctionFunction which returns googletag.defineSlot or googletag.defineOutOfPageSlot instance.
adUnitPathstringFull path of the ad unit with the network code and unit code.
idstringZone ID.
onSetup

Type: Function

Define additional initialization logic.

refreshZones(slots)

Type: Function

Refresh slots.

By default, it calls refresh method.

displayZone({element, id})

Type: Function

Display zone by ID.

By default, it calls display method.

slots

Type: googletag.Slot[]

List of slots to refresh.

instance.addZone({ slot, adUnitPath, id })

Add new zone with slot callback.

PropertyTypeDescription
slotFunctionFunction which returns googletag.defineSlot or googletag.defineOutOfPageSlot instance.
adUnitPathstringFull path of the ad unit with the network code and unit code.
idstringZone ID.

Browser support

Tested in IE9+ and all modern browsers.

Test

For automated tests, run npm run test:automated (append :watch for watcher support).

License

MIT © Ivan Nikolić

Keywords

FAQs

Package last updated on 14 Sep 2023

Did you know?

Socket

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc