• 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 15 replies - 1 through 15 (of 25 total)
  • Plugin Support Adam Dunnage

    (@adamdunnage)

    Hello @vsalgadinho, thanks for opening a support topic and sharing all the details you have. I’d be happy to help you with this. So that I can check your site, please could you share your?Site Health information. You can?use this form?to share privately if preferred.

    Once you have shared this then I can take a look at your site and ensure everything looks as it should and that there isn’t anything that shouldn’t be there or anything interfering with Site Kit on your site.

    Let me know if you have any other questions in the meantime.

    Thread Starter vsalgadinho

    (@vsalgadinho)

    Hi @adamdunnage , I submitted the form right after posting this topic, please check it.

    Plugin Support Adam Dunnage

    (@adamdunnage)

    Thanks @vsalgadinho, I just spotted that. Looking at your site’s source code I can see straight away that the Site Kit placed code on your site is being altered and minified. Looking at your active plugins I can see that you have the LiteSpeed cache plugin. Could you please check your LiteSpeed settings to see if you are minifying JS/CSS and if yes could you disable these settings?

    Once disabled, let me know and I can check your site source code once more to see if the Site Kit placed code then displays as it should?

    If this does appear to be the cause then I can share with you a way to exclude Site Kit code from being minified on your site allowing you to still use the LiteSpeed cache plugin with Site Kit.

    Thread Starter vsalgadinho

    (@vsalgadinho)

    Thank you for your prompt reply.

    I have already disabled all CSS/JS page optimisation options except the Font Display Optimisation option in the LiteSpeed plugin as requested. Please check the source code of the website again.

    Please check that the Google Tag configuration is set up correctly. The tag should only be used for Google Analytics at the moment. I want to make sure that no problems occur or settings are overlooked during setup, which could also be the cause of the problem.

    Plugin Support Adam Dunnage

    (@adamdunnage)

    @vsalgadinho Interestingly It still looks the same. Could you now try excluding Site Kit resources by excluding the?content/plugins/google-site-kit path?which can be done from LiteSpeed Cache > Page Optimization > [8] Tuning > JS Excludes.

    With regards to your question about unused JavaScript, this is normal if you’re using JavaScript libraries such as Google Analytics or any third party JavaScript Resource. It can appear due to not all the JavaScript from these libraries being executed at once, resulting in some unused JavaScript. You’ll find out more on this If you run PageSpeed Insights test on other websites that load third party scripts, you’ll likely find the same.

    For further information on this you can also review this Lighthouse GitHub issue, with Lighthouse being the technology used to run PageSpeed Insights scores.

    While you can disregard this notice as being normal, you may wish to consider AMP on your site if you’re looking to improve performance score.

    Thread Starter vsalgadinho

    (@vsalgadinho)

    I have already added the suggested path to be excluded in Litespeed. Any change?

    As for the AMP, I will have a look at it, thanks for the suggestion!

    Plugin Support Adam Dunnage

    (@adamdunnage)

    @vsalgadinho Thanks for confirming. Could I also ask you to temporarily switch your site theme to a default WordPress theme?

    Thread Starter vsalgadinho

    (@vsalgadinho)

    Done! Twenty Twenty-Four activated!

    Plugin Support Adam Dunnage

    (@adamdunnage)

    @vsalgadinho I still don’t see any change which is unusual. One other type plugin that we have seen conflicts with is maintenance and coming soon plugins. Could You also try disabling this plugin? Thanks for your patience and cooperation with this thus far!

    Thread Starter vsalgadinho

    (@vsalgadinho)

    Coming Soon plugin deactivated. I am the one who needs to thank you for your help!

    I wonder if I can send you my WP and Google Analytics/Tag Manager credentials via a private form instead (I will change them afterwards), so you can check everything and run the appropriate tests?

    Thread Starter vsalgadinho

    (@vsalgadinho)

    Hi @adamdunnage,

    I just wanted to let you know that I had inadvertently enabled the option offered by Google Analytics to place code in Site Kit, but I had my Google Tag linked to GA4 and the service was also linked in Site Kit.

    I am using only the “Place Code” option from GA in Site Kit. I also disabled the Tag Manager service and removed all tags, variables and triggers from Google Tag Manager, and created a new data stream for GA4. However, it says “Data collection is not active for your site”. I am not sure if this is normal because the changes were made recently, or if I have done something wrong (again)!

    Anyway, I then run new PageSpeed tests (with CSS/JS Lite speed page optimisation options disabled and my theme instead of the default WordPress theme). Performance has improved somewhat (now fluctuating between 89 and 96), although there are still two issues related to Site Kit/Google Tags:


    Reduce the impact of third-party code - Third-party code blocked the main thread for 250 ms
    Reduce unused JavaScript - Potential savings of 36 KiB
    Eliminate render-blocking resources - Potential savings of 60 ms

    I am not sure if there is something I can do about this?

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

    (@adamdunnage)

    @vsalgadinho Thanks for clarifying this and it is advised that if you are choosing Site Kit to place your module code, that you shouldn’t also manually place the code on your site.

    Glad to hear that you are noticing performance improvements on your site. When checking your site source code once more I am still unable to see the Site Kit placed code which is unusual. I am not seeing any tags that are being fired when checking your site in https://tagassistant.google.com/.

    I would recommend at this stage checking with your hosting provider to see if there are any security/firewall blocks on Site Kit or Google services or anything else that would prevent this. If you have no success with this then please let me know and we can continue to look into this for you.

    Thread Starter vsalgadinho

    (@vsalgadinho)

    Hi @adamdunnage,

    I have used the tag assistance and it has identified one tag, although no hits are shown as the site is new and I have no traffic yet. As for the firewall, I am using Cloudflare custom waf rules but I have not detected any blocking from Google or Google services. Could you please tell me what request is being made so I can check it further?

    Plugin Support Adam Dunnage

    (@adamdunnage)

    @vsalgadinho Thanks for confirming you are using Cloudflare waf rules. Are you able to temporarily disable Cloudflare on your site to check once more?

    Can You just also confirm you are using Site Kit to place your Analytics code snippet? Would you be able to share a screenshot of this in your Analytics settings?

    Thread Starter vsalgadinho

    (@vsalgadinho)

    I have already disabled my waf blocking rules, and yes, I am using Site Kit to place my Analytics code snippet. I am not able to upload the screenshot here (I do not know why, but I can not manage to load it), but in the “Code Snippet” of my Analytics section of Site Kit it says: Snippet is inserted.

    • This reply was modified 7 months, 3 weeks ago by vsalgadinho.
Viewing 15 replies - 1 through 15 (of 25 total)
  • The topic ‘Assistance Needed with Unused JavaScript and GTM Configuration’ is closed to new replies.