0
votes

I have a plain HTML file and am testing if the Google Ads and Analytics scripts work before adding it on other pages. A colleague who has an AdSense account sent me the script codes to add in the HTML head. After testing, the page shows nothing in any browser.

I had already disabled ad blocking, used incognito mode, and even copied the sample code from https://support.google.com/adsense/answer/181950?hl=en. Why don't the ads appear on the test page and how can I make them appear? The code is below (replaced sensitive numbers with XXXXX):

<!doctype html>
<html lang='en'>

    <head>
        <meta charset='utf-8' />
        <title>Test page</title>

        <script async src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>
        <script>
            (adsbygoogle = window.adsbygoogle || []).push({
                google_ad_client: "ca-pub-XXXXXXXXXXXXXXXXX",
                enable_page_level_ads: true
            });
        </script>

        <!-- Global site tag (gtag.js) - Google Analytics -->
        <script async src="https://www.googletagmanager.com/gtag/js?id=UA-XXXXXXXXX-X"></script>
        <script>
            window.dataLayer = window.dataLayer || [];
            function gtag(){dataLayer.push(arguments);}
            gtag('js', new Date());

            gtag('config', 'UA-XXXXXXXXX-X');
        </script>
    </head>

    <body>

    </body>
</html>

I also get the error:

GET https://www.google-analytics.com/analytics.js net::ERR_QUIC_PROTOCOL_ERROR
1

1 Answers

0
votes

Your GA code looks fine. And I dont see any reason for it to fail.

Please check if this is the issue.

  1. Open a new tab in Chrome

  2. Enter chrome://flags/ into the address bar

  3. Locate Experimental QUIC protocol

  4. Using the drop-down menu, select disable

  5. Restart Chrome

Reference: https://www.lucidica.co.uk/help/err_quic_protocol_error/