# Load ad tag over HTTPS

## Overview

Ensures that ad tag library scripts are being requested securely. This not only
provides better security for your users, it also improves performance. Since ad
requests issued by GPT always use HTTPS, loading the library itself from the
[recommended host](https://developers.google.com/publisher-ads-audits/reference/audits/loads-gpt-from-official-source) via HTTPS ensures that the
browser only needs to open 1 connection for all requests related to ad serving.

> [!NOTE]
> **Note:** This should only fail on non-secure websites, as most secure websites will automatically load scripts using HTTPS.

## Recommendations

Always load your ad tag scripts from an HTTPS URL.

|---|---|
| **Incorrect** | ```html <script> var el = document.createElement('script'); // Incorrect: potentially loading the ad tag over HTTP. var useSSL = 'https:' == document.location.protocol; el.src = (useSSL ? 'https:' : 'http:') + '//securepubads.g.doubleclick.net/tag/js/gpt.js'; var node = document.getElementsByTagName('script')[0]; node.parentNode.insertBefore(el, node); </script> ``` |
| **Correct** | ```html <script async src="https://securepubads.g.doubleclick.net/tag/js/gpt.js"></script> ``` |

## More information

The following ad tag library scripts are supported:

| Library | Script(s) |
|---|---|
| AdSense | `pagead2.googlesyndication.com/pagead/js/adsbygoogle.js` `pagead2.googlesyndication.com/pagead/show_ads.js` |
| Google Publisher Tag | `googletagservices.com/tag/js/gpt.js` `securepubads.g.doubleclick.net/tag/js/gpt.js` |

[Get Started with Google Publisher Tags](https://developers.google.com/publisher-tag/guides/get-started)
[View audit source](https://github.com/googleads/publisher-ads-lighthouse-plugin/tree/HEAD/lighthouse-plugin-publisher-ads/audits/loads-ad-tag-over-https.js) [Improve this article](https://github.com/googleads/publisher-ads-lighthouse-plugin/tree/HEAD/docs/audits/loads-ad-tag-over-https.md) [Report an issue](https://github.com/googleads/publisher-ads-lighthouse-plugin/issues/new?labels=documentation&template=documentation-feedback.md&title=Documentation+feedback:+loads-ad-tag-over-https.md)

<br />