You are here

dfp-js-head-bottom.html.twig in Doubleclick for Publishers (DFP) 8

Default theme implementation to display a DFP short tag.

Available variables:

  • async_rendering
  • single_request
  • collapse_empty_divs
  • disable_init_load
  • targeting

See also

dfp_page_attachments()

File

templates/dfp-js-head-bottom.html.twig
View source
  1. {#
  2. /**
  3. * @file
  4. * Default theme implementation to display a DFP short tag.
  5. *
  6. * Available variables:
  7. * - async_rendering
  8. * - single_request
  9. * - collapse_empty_divs
  10. * - disable_init_load
  11. * - targeting
  12. *
  13. * @see dfp_page_attachments()
  14. *
  15. * @ingroup themeable
  16. */
  17. #}
  18. <script type="text/javascript">
  19. googletag.cmd.push(function() {
  20. {% if async_rendering %}
  21. googletag.pubads().enableAsyncRendering();
  22. {% else %}
  23. googletag.pubads().enableSyncRendering();
  24. {% endif %}
  25. {% if single_request %}
  26. googletag.pubads().enableSingleRequest();
  27. {% endif %}
  28. {% if collapse_empty_divs == 1 %}
  29. googletag.pubads().collapseEmptyDivs();
  30. {% elseif collapse_empty_divs == 2 %}
  31. googletag.pubads().collapseEmptyDivs(true);
  32. {% endif %}
  33. {% if disable_init_load %}
  34. googletag.pubads().disableInitialLoad();
  35. {% endif %}
  36. {% for target in targeting %}
  37. googletag.pubads().setTargeting('{{ target.target }}', [
  38. {%- for value in target.value -%}
  39. '{{ value }}'{%- if not loop.last -%},{%- endif -%}
  40. {%- endfor -%}
  41. ]);
  42. {% endfor %}
  43. });
  44. googletag.enableServices();
  45. </script>