<!--
 Copyright 2022 Google LLC

 Licensed under the Apache License, Version 2.0 (the "License");
 you may not use this file except in compliance with the License.
 You may obtain a copy of the License at

      http://www.apache.org/licenses/LICENSE-2.0

 Unless required by applicable law or agreed to in writing, software
 distributed under the License is distributed on an "AS IS" BASIS,
 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 See the License for the specific language governing permissions and
 limitations under the License.
-->

<html>
  <head>
    <meta charset="utf-8">
    <title>Display a limited ad</title>
    <!---
     Load GPT from the limited ads URL to enable setPrivacySettings limited ads functionality.
    --->
    <script async src="https://pagead2.googlesyndication.com/tag/js/gpt.js"></script>
    <script>
      var ltdEnabled = true;
      window.googletag = window.googletag || {cmd: []};
      googletag.cmd.push(function() {
        googletag.defineSlot('/6355419/Travel', [728, 90], 'banner-ad')
                 .setTargeting('test', 'privacy')
                 .addService(googletag.pubads());
        googletag.enableServices();
        googletag.pubads().setPrivacySettings({limitedAds: true});
        googletag.pubads().refresh();
      });
    </script>
    <style>
      button::after {
        content: "OFF";
        color: red;
        font-weight: bold;
      }
      button[data-enabled="true"]::after {
        content: "ON";
        color: green;
        font-weight: bold;
      }
    </style>
  </head>
  <body>
    <div id="banner-ad" style="width: 728px; height: 90px;">
      <script>
        googletag.cmd.push(function() {
          googletag.display('banner-ad');
        });
      </script>
    </div>
  </body>
</html>

External CSS

This Pen doesn't use any external CSS resources.

External JavaScript

This Pen doesn't use any external JavaScript resources.