Viewing 9 replies - 1 through 9 (of 9 total)
  • Plugin Support James Osborne

    (@jamesosborne)

    Hi @optionshme, thanks for reaching out.

    When you mention additional JS are you referring to a notice in PageSpeed Insights or are you using your browsers developer tools to check for all scripts on each page load?

    If you’re referring to a PageSpeed Insights notification, such as in this support topic this is normal and it can be disregarded. When loading a JavaScript library or file such as an Analytics or Tag Manager script it’s normal that not all of that file requested will be used. You’ll find a guide on checking specifically what JavaScript is loaded per page by viewing this Google Developer documentation.

    If you’re checking your browsers developer tools you may notice an additional Site Kit script in the front end – if you have the admin toolbar enabled. This additional script will only be requested for you, as a logged on user. It’s used to provide insights on the current page visited.

    Any other scripts you may encounter in the sites front end may be related to the services you connected, or also any services you may have added to your Google Tag Manager account.

    If you want to share more details I’d be happy to look into this or assist further with any queries you may have.

    Thread Starter optionshme

    (@optionshme)

    Thank you James.

    The script is present on both Pagespeed Insights and chrome developer tools. This script was not present on Friday 4/9/21 when I was working on the site. I’m pretty sure it is tied to Site Kit, as when I remove Site Kit and clear caches, it does not appear on PSI or Dev tools anymore.

    It has an impact on page load speed, and I am curious as to why it is present, as I see the normal analytics script: https://www.googletagmanager.com/gtag
    /js?id=UA-118693464-1 that is tied to our property loading, like it always has been.

    When I remove Site Kit, then reinstall and reenable it, the new script in question only appears after I connect Analytics.

    Plugin Support James Osborne

    (@jamesosborne)

    Thanks for the response. I’d be happy to investigate this with you. I’m wondering if this script you’re referring to only appears when using the admin toolbar when you’re checking Chrome developer tools.

    In order to check this can you perform a test using web.dev and share the report URL so I can inspect this?

    It also sounds like you’re familiar with Chrome developer tools, so it would be great if you could check whether the same script appears when checking your site while not logged in (to ensure there are not admin toolbar related scripts loading).

    Thread Starter optionshme

    (@optionshme)

    James, thank you for your feedback.

    Here is the report you requested, with the script in question still showing up: https://lighthouse-dot-webdotdevsite.appspot.com//lh/html?url=https%3A%2F%2Foptionshme.com%2F

    I run Pagespeed Insights and Dev Tools in an incognito browser to eliminate the possibility of being logged in, so I do not believe that is the issue.

    Plugin Support James Osborne

    (@jamesosborne)

    Thanks for the update and for sharing the Lighthouse report. I’ve checked the Tag Manager script you’re referring to and it seems like you’ve implemented a GA4 Tag using Google Tag Manager – which of course you may have done so using Site Kit.

    If you remove all Google Tag Manager snippets on your site this script should not load, you will however loose any functionality of the tags contained within the same Tag Manager container. The snippet and resulting script also isn’t Site Kit specific, with the script requested if you manually insert your Google Tag Manager snippet as opposed to using Site Kit place the snippet.

    When you encounter notices about unused JavaScript regarding Google Analytics, Google Tag Manager or other services it’s not uncommon for unused JavaScript notices to occur. As many of these services request scripts with with various features not all the JavaScript will be used each time.

    So to summarize the script loading is normal, and not specific to Site Kit. It’s a Google Tag Manager with Google Analytics 4 script, which loads anytime these services are implemented on a users site (via Site Kit or manually placed). The unused JavaScript is typical in this case also.

    Also apologies for my last response, you had clearly referenced the specific script in your original post. You can in this case disregard my mention of the admin toolbar script.

    Let me know if you have any further questions on this and I’d be happy to help. From inspecting your Lighthouse report the biggest opportunity on your site when it comes to JavaScript isn’t flagged as a Site Kit placed script.

    Thread Starter optionshme

    (@optionshme)

    Thank you for your insight James, that helps narrow things down.

    I did enable GA4 briefly, but disabled it shortly after (on Monday). After reading your reply that is was a GA4 script, I completed the following today:

    1. Removed GA4 property from Analytics account within analytics.
    2. Deleted the only container within GTM.
    3. Reset Site Kit
    4. Deactivated Site Kit
    5. Deleted Site Kit
    6. Cleaned Databases
    7. Cleared Caches (script no longer showed when tested)
    8. Reinstalled Site Kit
    9. Connected Analytics via Site Kit (script reappeared at this point)

    Currently on my analytics account, the GA4 shows as a “Property” under my “Account,” with the GA4 property crossed out with a strikethrough. I do not see an option to further remove it.

    It certainly is not the largest opportunity for increasing page speed, but it does have an impact, and I currently do not have use for GA4. Any insights on how to clear the GA4 property off of the account entirely to stop the script from running?

    Plugin Support James Osborne

    (@jamesosborne)

    Thanks for the reply and for sharing the steps you’ve undertaken. If you’re looking to remove the Google Analytics reference from the “unused JavaScript” opportunity in LightHouse then removing the GA4 reference won’t achieve this. With a Google Analytics script requested it’s normal that the full contents of such a JavaScript file will be utilized during each page load. Here’s one Stackoverflow article with a thread on this notice, with a Lighthouse GitHub issue here, both containing more information on this.

    As mentioned this isn’t a concern and is normal that at present such files may reference unused JavaScript.

    If you’re still looking to remove the GA4 reference can you share whether you’ve connected a Universal Type property with a GA4 property via your Google Analytics account, by navigating to the Universal Type property. (Tracking Info > Tracking Code > Connected Site Tags). If you’ve connected a property please remove the connection. If there are no connected Site Tags can you share your Site Health information via this form and I can check your current setup and we can troubleshoot this reference on your site.

    It certainly is not the largest opportunity for increasing page speed, but it does have an impact, and I currently do not have use for GA4. Any insights on how to clear the GA4 property off of the account entirely to stop the script from running?

    This is correct, every little does help. Let me know how you get on with the above and we can hopefully determine the source of the additional snippet. Note that I don’t think removing the GA4 snippet will being any performance boosts, with the snippets on your site both using the same Google Analytics gtag.js file.

    Thread Starter optionshme

    (@optionshme)

    James, thank you for your patience and detailed responses. Removing the connected site tag was the ticket, the script no longer loads and is not present in Dev tools or PSI. Thank you for your help in resolving this issue.

    As a side note for other users, removing the site tag caused the site kit plugin to break my site temporarily. After disabling the plugin via FTP renaming, I was able to remove and reinstall the plugin with no issues. Site kit, analytics, and my site are all functioning normally now.

    Plugin Support James Osborne

    (@jamesosborne)

    Great news, appreciate the follow up. I’ve set some time aside to do some additional checks on my site for sites using both Google Analytics variations based on your experience.

    As a side note for other users, removing the site tag caused the site kit plugin to break my site temporarily

    This is very strange indeed, nice troubleshooting however to manually uninstall via FTP. As this shouldn’t be occurring if you happen to encounter this one more let me know, I’d love to hear more on this.

Viewing 9 replies - 1 through 9 (of 9 total)
  • The topic ‘Additional JavaScript ?’ is closed to new replies.