Skip to content

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.

window.htag = window.htag || { que: [] };
window.htag.que.push(function () {
window.htag.gamConfig = {
centering: true,
};
});
gamConfig?: googletag.config.PageSettingsConfig;

Enable horizontal centering of ads:

window.htag = window.htag || { que: [] };
window.htag.que.push(function () {
window.htag.gamConfig = {
centering: true,
};
});

For a complete list of available configuration options, see the GPT PageSettingsConfig Reference.

  • 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
  • start: Start htag and begin ad requests