@quintype/fastads
v1.0.0
Published
Fast DFP Ads
Downloads
3
Maintainers
Keywords
Readme
@quintype/fastads
Fastads is a library for fast loading of DFP ads. This library uses MutationObserver to insert ads, and should be compatible with react and jquery.
Usage
- Add gpt via the default gpt script, or via gtm
<script async="async" src="https://securepubads.g.doubleclick.net/tag/js/gpt.js"></script>
- Copy the contents of dist/fastads.html into a script tag at the top of the body.
<script data-version="@quintype/[email protected]">// Contents of dist/fastads.js here</script>
- Wherever you are placing a dfp tag, use the following syntax
<div data-dfp="3849069/Large_Leaderboard" data-dfp-size="[[970,90],[728,90],[320,100],[320,50]]"></div>
- Please note, the div inserted cannot have an id (as one is generated by fastads)
Parameters
| Parameter | Value | Example | Mandatory? | |----------------|---------------------------------------------------------|------------------------------------------|------------| | data-dfp | Ad Unit Id | 3849069/Large_Leaderboard | yes | | data-dfp-sizes | Sizes for the Ad (must be the same as specified in DFP) | [[970,90],[728,90],[320,100],[320,50]] | yes | | data-dfp-sizemapping | Viewport to size mapping. This accept pairs that are accepted by SizeMappingBuilder | [[[1024,768],[970,250]],[[640,480],'fluid'],[[0,0],[[1024,768],[970,250]]]] | no |