# Preload ads

The Ads Placement API downloads and caches ads for use in `adBreak()` calls.
By default it uses a set of automatic heuristics to determine the best times to
download ads. However, these heuristics may mean that an ad has not yet been
loaded before the very first placement in your game (such as your first call to
`adBreak()` just as your game is loading).

You can adjust this behaviour using the `adConfig()` call to force preloading of
ads immediately as follows.

    <script async
          src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js?client=ca-pub-123456789"
          crossorigin="anonymous">
    </script>
    <script>
       window.adsbygoogle = window.adsbygoogle || [];
       var adBreak = adConfig = function(o) {adsbygoogle.push(o);}
       adConfig({preloadAdBreaks: 'on'});
    </script>

**Important** : If you want to force preloading of ads, you
should make this call before the first call to `adBreak()`. Once
you've set a value for `preloadAdBreaks`, any subsequent attempts to
change it are ignored.

To help ensure that ads show early in you game, you can:

1. Make sure that ads are preloaded by calling `adConfig({preloadAdBreaks: 'on'})`. This ensures that there is an ad ready to go before the first call to `adBreak()`.
2. Reduce the `data-ad-frequency-hint` so that ads show more frequently.