• Resolved vsalgadinho

    (@vsalgadinho)


    Dear Site Kit Support Team,

    I need your help with some issues identified in a recent PageSpeed Insights report for my website. The report indicated possible savings of 141 KiB due to unused JavaScript in Google Tag Manager (GTM) and Google Analytics 4 (GA4).

    Details of the PageSpeed Insights report can be found in the Site Health Information Form

    I am currently use Site Kit to manage my Google Analytics settings, but it appears that three separate tags related to Google Analytics and Google Tag Manager are loaded on the page.

    Could you please help me with the following issues:

    1. Confirm if these multiple tags are expected or if there is a configuration issue causing the redundant tags to load.
    1. Inform me of best practises (for those who do not have coding knowledge) to reduce unused JavaScript and optimise the loading of GTM and GA4 scripts to ensure only necessary scripts are loaded.

    Thanks!

Viewing 10 replies - 16 through 25 (of 25 total)
  • Plugin Support Adam Dunnage

    (@adamdunnage)

    @vsalgadinho Thanks for sharing the information. I just want to confirm that it is Site Kit placing the code and it is not being placed manually or by another plugin/service. When going to your Site Kit Analytics settings do you see the following when choosing to edit: https://imgur.com/a/P7Kg3Tu.

    I am just taking another look at your site also to see if I can see what might be causing this.

    Thread Starter vsalgadinho

    (@vsalgadinho)

    Yes, that’s exactly what I see when I click on Edit; the toggler is switched on.

    Oddly enough, I have now tried to use the tag assistance again, but now I can not see the tag. I have already tried a few plugins and options to place the tags, including Tag Manager (via Site Kit, as I said before), but also Monster Insights. I have uninstalled these plugins, but I am not sure if this has completely deleted the files in the database etc and could be causing the problem.

    I have tried restoring a previous version of my site to solve the problem, but that did not work either. So I am assuming that the problem could be related to the configuration of my tag and will go through the instructions step by step to see if I have missed anything.

    • This reply was modified 7 months, 3 weeks ago by vsalgadinho.
    • This reply was modified 7 months, 3 weeks ago by vsalgadinho.
    Thread Starter vsalgadinho

    (@vsalgadinho)

    Update: The tag is now recognised by the Tag Manager, but when I click on the Google Analytics data stream, the message “Data collection isn’t active for your website. If you installed tags more than 48 hours ago, make sure they are set up correctly.”. I have tried accessing my own site to trigger the tag and my visits are showing up in my Analytics report, which I access through Google Analytics itself, but not through my Site Kit dashboard. I will wait some time to see if anything changes. If not, I will probably give up and hire an expert in the future.

    Thread Starter vsalgadinho

    (@vsalgadinho)

    I have just realised that when I examine the header of my website with the inspect tool, the following a script saying:

    <!-- Google Analytics opt-out snippet added by Site Kit -->
    <script>
    window["ga-disable-G-49584GEJ5G"] = true;
    </script>
    <!-- End Google Analytics opt-out snippet added by Site Kit -->

    I am not sure if this script is normal, but could it be that the script is preventing Google Analytics from collecting data? If so, is there a specific procedure or settings in the Site Kit plugin or elsewhere that need to be adjusted?

    • This reply was modified 7 months, 3 weeks ago by vsalgadinho.
    Plugin Support Adam Dunnage

    (@adamdunnage)

    @vsalgadinho Thanks for the updates. You mentioned that you already tried a few different iptions to place tags. It’s possible that as you say something is still there which may be impacting Site Kit placing its code.

    In relation to the opt-out snippet this is a separate snippet that appears only for logged in users if you’ve enabled?this configuration?to not count logged in users (it’s toggled on by default). This is found in your Site Kit Analytics settings.

    You will be seeing this while logged into your site but if you log out of the site and navigate to it and view the source code you should see that this opt out snippet is not there. This is because you are not logged into your WordPress admin account at the time of viewing the frontend of your website.

    Do you have the option to create a new site on the same hosting provider or even a subdomain with a separate WordPress install? If you can then please could you try setting this up and firstly just add Site Kit and setup to see if you see the same in your source code for this site?

    Thread Starter vsalgadinho

    (@vsalgadinho)

    Hi @adamdunnage,

    Yes, I noticed that the “Exclude all logged in users” option was enabled in Site Kit, which probably prevented my visits from being counted in the traffic data.

    However, when I switched to the Google Tag Manager for Analytics Place Code snippet, I noticed that I had not properly included my domain in the Tag Coverage section of Analytics; it was only listed as “suggested”,” not added. I believe this may also be the cause of the problem, as I added it yesterday and checked again today. It appears that the tags are now working correctly and Google Analytics is displaying the message “Data collection has been active in the last 48 hours”. Finally! ??

    Now the tags are working, but back to the original problem that brought me to this forum: My performance score has dropped from 100 to 90-94. Could you please check if there is a way to reduce the impact of the third party code and unused JavaScript generated by the tags and Analytics?

    Plugin Support Adam Dunnage

    (@adamdunnage)

    @vsalgadinho Thank you for the update, that’s good to hear about your Analytics.

    With regards to your question about performance and reducing unused JavaScript, as mentioned before it is normal when using JavaScript libraries such as Google Analytics or any third party JavaScript Resource that this will have a small impact on your site.

    As previously stated, these messages can appear due to not all the JavaScript from these libraries being executed at once, resulting in some unused JavaScript.

    We are limited in the support we can offer with regards to site performance and unused JavaScript as we provide support for the Site Kit plugin itself. You may find some extra useful information on this here.

    I hope this helps with that. Is there anything else I can help you with on the Site Kit side of things at this stage?

    Thread Starter vsalgadinho

    (@vsalgadinho)

    Yes, I have one more question: could enabling any of Litespeed’s CSS/JS optimisation options have a negative impact on Site Kit Analytics and the tags in question, causing issues with data collection or functionality? If so, should I add the path “content/plugins/google-site-kit” to the JS and CSS exclusion sections (or any other section) in Litespeed to avoid this?

    Plugin Support Adam Dunnage

    (@adamdunnage)

    @vsalgadinho While we can’t guarantee how Site Kit will behave with other third party plugins, we would recommend using the exclusion you proposed when using these optimization plugins.

    If you do run into any issues with Site Kit then we will be happy to help you with that.

    Thread Starter vsalgadinho

    (@vsalgadinho)

    Ok, thank you for your help and patience, @adamdunnage!

Viewing 10 replies - 16 through 25 (of 25 total)
  • The topic ‘Assistance Needed with Unused JavaScript and GTM Configuration’ is closed to new replies.