Skip to content

quintype/quintype-node-fastads

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

@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>
<script data-version="@quintype/fastads@1.0.0">// Contents of dist/fastads.js here</script>
  • Alternatively, you may use the script directly from jsdelivr, or you may inline the contents of the script
<script src="https://cdn.jsdelivr.net/npm/@quintype/fastads@1/dist/fastads.js"></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
data-dfp-targeting Array of targetting rules. Since targetting rules are global, it's sufficient to set the targetting rules on any one ad [["story-type","text"],["sponsored-by","me"]] no