> For the complete documentation index, see [llms.txt](https://mobkoi.gitbook.io/docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://mobkoi.gitbook.io/docs/publisher-integrations/maximize-visible-impressions-in-gtm.md).

# Maximize Visible impressions in GTM

1. Enable Lazy Loading in GTM
2. This is done in your site code, not in the GAM UI.
3. GTM offers built-in lazy loading with viewport thresholds.

You can configure how close the ad must be to the viewport before triggering a request (can be set to 0 for “in-view”).

```javascript
<script async src="https://securepubads.g.doubleclick.net/tag/js/gpt.js"></script>
<script>
  window.googletag = window.googletag || {cmd: []};
  googletag.cmd.push(function() {
    // Enable lazy loading with threshold
    googletag.pubads().enableLazyLoad({
      fetchMarginPercent: 0,    // Start fetching when slot is in view
      renderMarginPercent: 0,   // Render when fully in viewport
      mobileScaling: 1.0
    });

    googletag.defineSlot('/1234567/example', [300, 250], 'div-gpt-ad-1234567-0')
             .addService(googletag.pubads());

    googletag.enableServices();
  });
</script>

```

<br>
