Configure Tag Manager to use protocol-relative URLs

Stay organized with collections Save and categorize content based on your preferences.

To help secure tag data, the Google Tag Manager container tag uses HTTPS to load resources (i.e. https://www.googletagmanager.com).

If you need to load your Tag Manager containers in a protocol-relative manner, you may do so by adjusting the protocol in your container code to be // instead of https://.

<!-- Google Tag Manager -->
<script>(function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start':
new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0],
j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src=
'//www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f);
})(window,document,'script','dataLayer','GTM-XXXXXX');</script>
<!-- End Google Tag Manager -->
<!-- Google Tag Manager (noscript) -->
<noscript><iframe src="//www.googletagmanager.com/ns.html?id=GTM-XXXXXX"
height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript>
<!-- End Google Tag Manager (noscript) -->

When you use a protocol-relative URL, the container is loaded via HTTP on pages that use http://, and via HTTPS on pages that use https://.

Older versions of the Tag Manager container code used a protocol-relative URL to load containers (i.e., //www.googletagmanager.com). These older protocol-relative versions of the Tag Manager container code will continue to work.