Search
Clear search
Close search
Google apps
Main menu

Ad Exchange ad code support for SSL

This ad code support applies to Ad Exchange Inventory Controls.

Ad Exchange has added support for secure ad serving through Secure Sockets Layer (SSL) on Hypertext Transfer Protocol Secure (HTTPS) web pages. This means that publishers with secure websites, i.e., sites using HTTPS protocol, can now use Ad Exchange ad code to serve SSL-compliant ads. Examples of secure websites include many financial services sites, e-commerce sites, and social networking sites.

Important things to know about the SSL-compatible ad code: 

  • The SSL-compatible code also works on HTTP sites and doesn’t change how ads are served on these sites.
  • Ad Exchange supports SSL inventory today by allowing you to provide inventory over HTTPS and to receive only HTTPS creatives.
  • Ad Exchange supports backfill from DFP of HTTPS inventory by enabling you to provide inventory over HTTPS via DFP and to receive only HTTPS compliant creatives.
  • Ad Exchange supports HTTPS for Ad Exchange buyers today by permitting buyers to submit HTTPS creatives.
  • Ad Exchange ensures the compatibility of HTTPS based inventory with HTTPS creatives. The system automatically checks creatives for their SSL compliance and only serves ads that are HTTPS on HTTPS inventory to avoid browser notifications.
Older versions of the Ad Exchange ad code don’t work with secure content. If you try to run HTTP ads on an HTTPS site, on most older browsers your visitors will get a mixed content warning, while on some modern browsers your visitors might not see any ads at all. If you want to place ads on secure pages, you’ll need to use the new SSL-compatible ad code.

Implement the new ad code on your HTTPS-enabled pages

This procedure only applies to traffic sent directly from the page of a third-party ad server. DFP no longer relies on Ad Exchange inventory tags for targeting. Learn best practices for trafficking Ad Exchange in DFP

Use either of the options outlined here:

  • Option 1 - Generate your ad code (for ad units) or use the Tag generator (in Enhanced Inventory Controls) and paste the ad code into the HTML source code on your page where you'd like the ad to appear.
  • Option 2 - Modify your existing ad code--make the following code updates:
    • Synchronous ad code snippet
  • <script>
    google_ad_client="ca-pub-xxxxxxxxxxxxxxxxxxxx";
    google_ad_slot="yyyyyyyyyyyyyyyy";
    google_ad_width=300;
    google_ad_height=250;
    </script>
    <script src="//pagead2.googlesyndication.com/pagead/show_ads.js">
    </script>
    • Asynchronous ad code snippet
  • <script async src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>
    <ins class="adsbygoogle"
    style="display:inline-block;width:300px;height:250px"
    data-ad-client="ca-pub-xxxxxxxxxxxxxxxxxxxx"
    data-ad-slot="yyyyyyyyyyyy">

    </ins>
    <script>
    (adsbygoogle=window.adsbygoogle || []).push({});
    </script>
HTTP has been removed from both script sources, as shown above. The source URLs begin with two forward slashes:
//pagead2.googlesyndication.com/pagead/show_ads.js
//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js 
Was this article helpful?
How can we improve it?