Google Analytics Code Visible at top of Website

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #29836

    Golfing Herald
    Participant

    Good afternoon. I am new to this forum. Currently developing my first WordPress website. Have installed Dfactory Cookie Notice Plugin and have entered the following into the Script Blocking (Head) Section (have replaced the actual Google Analytics code with X’s)

    //www.googletagmanager.com/gtag/js?id=UA-XXXXXXXXX-1
    <script>
    window.dataLayer = window.dataLayer || [];
    function gtag(){dataLayer.push(arguments);}
    gtag(‘js’, new Date());

    gtag(‘config’, ‘UA-XXXXXXXXX-1’);
    </script>

    Thought all was good but get the following at the top of my website if simulating iPad or mobile views

    //www.googletagmanager.com/gtag/js?id=UA-XXXXXXXXX-1

    I am struggling to understand what I have done wrong (e.g. maybe a missed step), so would really appreciate the support from this forum to understand and resolve

    Thanks in advance

    Paul

    #29846

    Golfing Herald
    Participant

    Hi….still hoping for a response from this forum.

    To add additional info, and not sure if related to the issue I raised but when I copy and paste the snippet of code provided by Google, namely:

    <!– Global Site Tag (gtag.js) – Google Analytics –>
    <script async src=”https://www.googletagmanager.com/gtag/js?id=UA-XXXXXXXXX-1″></script>
    <script>
    window.dataLayer = window.dataLayer || [];
    function gtag(){dataLayer.push(arguments);}

    gtag(‘js’, new Date());

    gtag(‘config’, ‘UA-XXXXXXXXX-1’);
    </script>

    …..I end up with the following when saving changes for this plugin:

    //www.googletagmanager.com/gtag/js?id=UA-XXXXXXXXX-1
    <script>
    window.dataLayer = window.dataLayer || [];
    function gtag(){dataLayer.push(arguments);}
    gtag(‘js’, new Date());

    gtag(‘config’, ‘UA-XXXXXXXXX-1’);
    </script>

    So, reaching out to this wider community to help resolve this for a wordpress/dfactory newbie !!

    Best Regards

    Paul

Viewing 2 posts - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.