> For the complete documentation index, see [llms.txt](https://docs.relevant-digital.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.relevant-digital.com/hb-manager/auction-behavior-and-optimization/lazy-loading-with-gam.md).

# Lazy loading with GAM

## In this section we will walk you through Google Ad Manager lazy loading settings in HB Manager

Google AdManager lazy load

In addition to our own lazy load function, we have added support for the more standardized, GAM's lazy load.

You can find the setting by going under the wanted Publisher account, and selecting the Prebid Parameters next to the website where you want to enable the GAM lazy load.

Find the section in

**Prebid Parameter > Generic Prebid Config Data > GAM Lazy Load Settings.**

### ![Näyttökuva 2023-12-20 kello 15.37.11](/files/ac74d912ebba3b6563540c4a14fd81a47b774f64)

Google Ad Manager (GAM) uses viewport-based lazy loading to ensure that ads are only loaded when they are likely to be seen. This improves page load speed and user experience by prioritizing content over below-the-fold ads.

### 1. Fetch Margin

The **Fetch Margin** determines when the ad request is sent to the server.

* **What it does:** It tells the browser, "Go get the ad data from GAM now."
* **The Math:** This value is a percentage of the viewport height.
* **Example:** A value of **500** represents 500% (or 5 viewports). If the user is 5 screen-lengths away from the ad slot, the fetch process begins.
* **Why it matters:** Fetching is usually set higher than rendering to account for network latency, ensuring the "creative" is ready before the user arrives.

### 2. Render Margin

The **Render Margin** determines when the ad is actually displayed on the page.

* **What it does:** It triggers the browser to draw the ad and insert it into the DOM.
* **The Math:** Also a percentage of the viewport height.
* **Example:** A value of **200** (2 viewports) means the ad won't actually appear until the user is significantly closer to the slot.
* **Why it matters:** Postponing the render saves the user’s device CPU and memory. It also ensures that the "Impression" is tracked as close to the actual view as possible.

### 3. Mobile Multiplier

Mobile users typically scroll faster than desktop users, but mobile networks can be less stable. To account for this, GAM provides a **Mobile Multiplier**.

* **How it works:** This is a scaling factor applied to both the Fetch and Render margins specifically for mobile devices.
* **The Logic:** If your Desktop Fetch Margin is 200 and your **Mobile Multiplier is 2.0**, the effective Fetch Margin on mobile becomes **400**.
* **The Goal:** By doubling the margin on mobile, you start the ad process even earlier, giving the ad more time to load before a fast-scrolling mobile user reaches the slot.

| Feature               | Unit          | Purpose                                               |
| --------------------- | ------------- | ----------------------------------------------------- |
| **Fetch Margin**      | % of Viewport | When to call the server for an ad.                    |
| **Render Margin**     | % of Viewport | When to display the ad in the browser.                |
| **Mobile Multiplier** | Scalar (x)    | Increases margins on mobile to offset fast scrolling. |

{% hint style="info" %}
Whereas [with our lazy load function](/hb-manager/auction-behavior-and-optimization/lazy-loading-ads-in-hb-manager.md) you can adjust the lazy load per placement, **GAM's lazy loading applies only on a site level** and should be adjusted under the site level parameters.

However, you can utilise both technologies side-by-side if needed. Basically there is no priority, but the "laziest" will win.
{% endhint %}


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.relevant-digital.com/hb-manager/auction-behavior-and-optimization/lazy-loading-with-gam.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
