Remco
Remco

Reputation: 357

Google analytics is included in the header, but doesn't work

So I am working on nosleeplessnights.com and have google analytics added to the header. For some reason it doesn't work and tag managers says the script is missing.

<script type="text/javascript">
        (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
        (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
        m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
        })(window,document,'script','https://www.nosleeplessnights.com/analytics.js','ga');

        ga('create', 'UA-35194122-1', 'auto');
        ga('send', 'pageview');

    </script>

"Missing analytics.js script" Any idea what I'm doing wrong here?

Upvotes: 0

Views: 169

Answers (2)

Remco
Remco

Reputation: 357

we swapped to gtags which worked. not a real solution, but still - it worked.

Upvotes: 0

lkostka
lkostka

Reputation: 751

In your snippet you re asking ga to look for the analytics.js script at https://nosleeplessnights.com/analytics.js, try replacing this url in your snippet with the official one : https://www.google-analytics.com/analytics.js

Upvotes: 2

Related Questions