gamConfig
The gamConfig property allows you to pass custom configuration options to Google Publisher Tag (GPT) via googletag.setConfig(). This enables fine-grained control over GPT behavior such as ad centering, lazy loading, privacy treatments, and more.
Example
Section titled “Example”window.htag = window.htag || { que: [] };window.htag.que.push(function () { window.htag.gamConfig = { centering: true, };});gamConfig?: googletag.config.PageSettingsConfig;Common Use Case: Ad Centering
Section titled “Common Use Case: Ad Centering”Enable horizontal centering of ads:
window.htag = window.htag || { que: [] };window.htag.que.push(function () { window.htag.gamConfig = { centering: true, };});Available Options
Section titled “Available Options”For a complete list of available configuration options, see the GPT PageSettingsConfig Reference.
Important Notes
Section titled “Important Notes”- Configuration must be set before
htag.start()is called - Only ads requested after the configuration is applied will be affected
- This uses the modern
googletag.setConfig()API
Related
Section titled “Related”- start: Start htag and begin ad requests