Clear search
Close search
Google apps
Main menu

Override AdSense attributes in the tags on your page

Override AdSense attributes with Google Ad Manager (GAM) tags

You can pass page- or unit-level AdSense setting overrides when tagging your pages:

  • GA_googleAddAdSensePageAttr("param", "value") Use this tag to override AdSense parameters for all the ad units on the page.
  • GA_googleAddAdSenseSlotAttr("unitcode", "param", "value") Use this tag to pass AdSense parameters for a particular ad unit. If both a unit-level and page-level setting exist, the unit-level setting would override the page-level setting.

You can override the following parameters:

  • Border: param = google_color_border
  • Title: param = google_color_link
  • Background: param = google_color_bg
  • Text: param = google_color_text
  • URL: param = google_color_url
  • Alternate ad URL: param = google_alternate_ad_url
  • Ad unit (text, image, text/image): param = google_ad_type
  • Corner style: param = google_ui_features
  • Channel: param = google_ad_channel

To learn more about inserting AdSense attributes into your tags, see Configuring Google Ad Manager (GAM) tags for DFP Small Business.

Override AdSense attributes with Google Publisher Tags (GPT)

In most cases, you'll have already set formatting for your AdSense ads in DFP or AdSense. However, if you want to override this formatting at the individual page level, you can insert the following code into your tags.

For asynchronous tags:

  googletag.cmd.push(function() {
    googletag.pubads().set("adsense_background_color", "FFFFFF");

For synchronous tags:

  googletag.pubads().set("adsense_background_color", "FFFFFF");

To learn more about inserting AdSense attributes into your Google Publisher tags, see the API documentation for the .set() function.

Was this article helpful?