Dynamic injection

This type of injection is more advanced and allows for the dynamic integration of ad slots according to page templates and user navigation. It's based on viewports and enable optimization of incontent injections while respecting user experience.

The available parameters provide flexibility for injection.

  • .setDynamicSelector: Defines the page element for injection.

  • .setDynamicMainContentSelector: Defines the class or id in which you want to inject ad slots.

  • .setDynamicFirstOffsetSelector: Defines the element from which the first injection will be triggered.

  • .setDynamicDensityIndex: Defines the density of injections on the page. The value "1" corresponds to 1 viewport, so an injection will be triggered each viewport if the criteria of .setDynamicSelector are met. You can set up a value of "0.8" for a higher density of ad slots or a value of "2" for a lower density, for example.

  • .setDynamicMaxRepetition: Enables limiting the injection occurrences on the page. The function will adapt the distance between ad slots so that spacing is regular.

  • .setDynamicStyle: Applies a CSS style to the injected ad slot.

  • .setDynamicBeforeStyle:

  • .setDynamicLabel: Names an ad placement. This name will be incremented at each injection, allowing detailed and proper monitoring. For example: "incontent1" then "incontent2" then "incontent3".

  • .activateDynamicIncrementalAdUnitId : Enables the activation of the auto-creation of incremental GAM ad units. This is optional and can be useful depending on your inventory structure to better monitor each ad unit's performance.

  • .setDynamicIncrementalTargeting : Enables attributing a specific value to each injected ad unit. It must replace .setTargeting in case of identical key in order to avoid duplicate entries.

Here is a code example without the function .activateDynamicIncrementalAdUnitId :

n360Ad.defineDynamicSlot('/your_GAM_network_ID/your_GAM_adunit',[[300,250],['fluid']],'div-3')
  .setNexx360TagId('ENTER YOUR PLACEMENT ID')
  .setDynamicSelector('h3')
  .setDynamicMainContentSelector('.content')
  .setDynamicFirstOffsetSelector('.megabanner')
  .setDynamicDensityIndex(1)
  .setDynamicMaxRepetition(8)
  .setDynamicStyle('text-align:center; margin-bottom: 20px;')
  .setDynamicBeforeStyle('line-height:20px; content:Publicité; color: #777; font-size: 10px; display:inherit')
  .setDynamicLabel('adunit', 'incontent_ad')
  .setTargeting('adunit', 'incontent_ad')
  .setTargeting('position', 'mtf');

Here is a code example with the function .activateDynamicIncrementalAdUnitId :

n360Ad.defineDynamicSlot('/your_GAM_network_ID/your_GAM_adunit',[[300,250],['fluid']],'div-3')
  .setNexx360TagId('ENTER YOUR PLACEMENT ID')
  .setDynamicSelector('h3')
  .setDynamicMainContentSelector('.content')
  .setDynamicFirstOffsetSelector('.megabanner')
  .setDynamicDensityIndex(1)
  .setDynamicMaxRepetition(8)
  .setDynamicStyle('text-align:center; margin-bottom: 20px;')
  .setDynamicBeforeStyle('line-height:20px; content:Publicité; color: #777; font-size: 10px; display:inherit')
  .setDynamicLabel('adunit', 'incontent_ad')
  .activateDynamicIncrementalAdUnitId()
  .setDynamicIncrementalTargeting('adunit', 'incontent_ad-')
  .setTargeting('position', 'mtf');

Last updated