Netlify script appears as third party script in Google Page Speed test

When I test a page through Google Page Speed, Netlify appears in the “Reduce the impact of third-party code” section with a 311KB big file.

I wonder, where does Netlify’s script come from?

@marvinhuebner, Netlify doesn’t modify your site code (unless you use our asset optimization but, even then, the changes are only to formatting and not to the code itself).

The point I am making is that we are definitely not adding any third-party javascript to your site. (But I understand why you would be concerned if PageSpeed Insights made it seem like we were.)

I believe this is a reference to the site’s javascript being loaded from a subdomain of netlify.com (specifically, loading from bergwerk-next.netlify.com).

Now, if you do see any Netlify specific javascript being injected into your deployed site, please let us know. This would be highly unusual and we also would want investigate this immediately.

Again, though, I’m nearly certain that this just the PageSpeed Insights tool calling the site javascript “third-party” javascript when it actually isn’t.

If there are other questions, please let us know and we’ll be happy to answer.

Thanks for the clarification. Now I think this comes like you already said that the javascript gets loaded from bergwerk-next.netlify.com, that totally makes sense, I just didn’t think of that at all. I checked it again on our live page now, and netlify doesn’t appear on the third party resources. I already checked it before, but I couldn’t explain me where it came from on the bergwerk-next site.

Sorry for any confusion from my side.

1 Like

@luke I have the same issue and, without going into technicalities, the fact is that Lighthouse is showing Netlify’s code as being detrimental to performance and thus decrements the score of the app in question.

As a freelance developer I use Lighthouse’s scores as a marketing tool and it is not very comfortable to be in a position where I have to argue with a potential customer that the tool I am using to show my apps are well graded is not accurate. So, either Lighthouse is wrong, or somehow it’s picking you up as detrimental to performance. Either case it should be corrected.

My app is at https://musing-davinci-538143.netlify.com/

Hi, @BernardA, I suspect there is a misunderstanding about what that report says. It says the slow code is hosted at musing-davinci-538143.netlify.com. This is your code not Netlify’s code.

It is your code hosted under a netlify.com subdomain. So the Lighthouse reports that domain as the source of the issue and does so labeling it as “Netlify”. However, we didn’t write that code, you did (or at least it is the code you uploaded).

My point here is that is code only controlled by you, not by Netlify.

Netlify doesn’t modify the content hosted on our CDN except in three limited and intentional use cases:

  • snippet injection
  • post processing optimizations
  • a small change to the <form> if Forms are used

This site isn’t isn’t using any of those.

Even if it was, we only minify existing javascript or inject exactly what you tell us to. It is still your javascript/HTML, not ours. For the Forms change, that is HTML only. IT wouldn’t affect site performance in any way and, again, this site isn’t using Forms in the first place.

If Lighthouse says the “Netlify” javascript code is slow - it means the site javascript at musing-davinci-538143.netlify.com - not something at www.netlify.com. This is only code you uploaded and not something we can control. If you want to improve the performance of that code you are the only one that can do so as only you control that site’s code.

Please do not blame Netlify. We’re in the report only because that is we are where the code is hosted. We didn’t write the slow code though.

Hi @luke, the app in question has no separate javascript added to it. This is a 100% Gatsby app, whatever javascript is in there is processed by Gatsby.

It is important to note that Lighthouse is not saying this is an issue with the app’s own javascript, but rather a third-party script.

Hi, @BernardA, I have looked at that site. The only javascript loaded is the site’s javascript. Netlify doesn’t add any javascript to any sites - ever. (You can with snippet injection, but you must do so manually and we only inject what you tell us to.)

Yes, I see the same thing you are stating in PageSpeed Insights. It does say “third-party” and “Netlify” there:

However, this PageSpeed/Lighthouse tool doesn’t understand what Netlify is. The PageSpeed/Lighthouse tool isn’t perfect. It is calling the site javascript third-party javascript when it is not. PageSpeed/Lighthouse is wrong.

It is flagging this as third-party javascript but it isn’t. This is your site’s javascript. There is no third-party Netlify javascript in that site.

I checked every href in the HTML. There is no Netlify javascript anywhere in that site:

$ curl -s https://musing-davinci-538143.netlify.com/ | egrep -o '(href[^>]*)'
href="/styles.6ff6924fe19333074d97.css"
href="/icons/icon-48x48.png?v=edf3d310d67f8284a562bc3a58c3e761"/
href="/manifest.webmanifest"/
href="/icons/icon-48x48.png?v=edf3d310d67f8284a562bc3a58c3e761"/
href="/icons/icon-72x72.png?v=edf3d310d67f8284a562bc3a58c3e761"/
href="/icons/icon-96x96.png?v=edf3d310d67f8284a562bc3a58c3e761"/
href="/icons/icon-144x144.png?v=edf3d310d67f8284a562bc3a58c3e761"/
href="/icons/icon-192x192.png?v=edf3d310d67f8284a562bc3a58c3e761"/
href="/icons/icon-256x256.png?v=edf3d310d67f8284a562bc3a58c3e761"/
href="/icons/icon-384x384.png?v=edf3d310d67f8284a562bc3a58c3e761"/
href="/icons/icon-512x512.png?v=edf3d310d67f8284a562bc3a58c3e761"/
href="/component---src-pages-index-js-3c19039f4cd8984134d6.js"/
href="/commons-5bc06b38d86e56daf034.js"/
href="/app-16f68e476249d964ef47.js"/
href="/styles-4ba8e325537f9cd534dc.js"/
href="/webpack-runtime-5a7e22c007684047792c.js"/
href="/page-data/index/page-data.json" crossorigin="anonymous"/
href="/"
href="/login"
href="/register"
href="/"
href="/search"
href="/adview/91040"
href="/adview/91041"
href="/adview/91042"
href="/search/france/objects/furniture"
href="/search/france/objects/furniture/kitchen-cupboard"
href="/search/france/objects/furniture/kitchen-table"
href="/search/france/objects/furniture/sofa"
href="/search/france/objects/home-appliance"
href="/search/france/objects/home-appliance/refrigerator"
href="/search/france/objects/tools"
href="/search/france/objects/tools/grinder"
href="/search/france/objects/tools/power-drill"
href="/search/france/objects/tools/sander"
href="/search/france/objects/tools/saw"
href="/search/france/services/cleaning"
href="/search/france/services/cleaning/garden-cleaning"
href="/search/france/services/cleaning/house-cleaning"
href="/search/france/services/language-training"
href="/search/france/services/language-training/chinese-teacher"
href="/search/france/services/language-training/english-teacher"
href="/search/france/services/language-training/french-teacher"
href="/search/france/services/language-training/spanish-teacher"
href="/search/france/services/personal-services"
href="/search/france/services/personal-services/sports-coach"
href="/search/france/services/personal-services/tax-return"
href="/search/france/services/sharing-pooling"
href="/search/france/services/sharing-pooling/car-pooling"
href="/"
href="/"
href="/search"
href="/contact"
href="/legal"
href="/"

If you have reason to believe we are injecting third-party javascript into your site (which I promise you we are not) then I’ll need facts which prove this. I believe I’ve very thoroughly disproved it but if I’m missing something, please correct me.

I’m open to the possibility of I’m wrong. I do have facts proving what I’m saying is correct. I could be missing something or making a mistake but, if so, I don’t see it.

If there are more details or something I’m missing, I do want to know about it. Please do show me the proof you have that this is Netlify’s javascript (besides the incorrect report from PageSpeed/Lighthouse).

If you have any evidence that some Netlify javascript is being loaded on your site, please do share that information with us. We’re happy to research this further.

Here is a list of every JavaScript call in your main document, although these calls may in turn call more JavaScript, especially the second one.:

script id="gatsby-script-loader"
script id="gatsby-chunk-mapping"
script src="/webpack-runtime-5a7e22c007684047792c.js" async=""
script src="/styles-4ba8e325537f9cd534dc.js" async=""
script src="/app-16f68e476249d964ef47.js" async=""
script src="/commons-5bc06b38d86e56daf034.js" async=""
script src="/component---src-pages-index-js-3c19039f4cd8984134d6.js" async=""

That second script call subsequently refers to:

/app-16f68e476249d964ef47.js
/component---node-modules-gatsby-plugin-offline-app-shell-js-ae1ae5243345b2103fa3.js
/component---src-templates-search-js-e3a511e068e484713043.js
/component---src-pages-404-js-18bf080885822eae9530.js
/component---src-pages-account-js-7cee0e672fbb19b61d75.js
/component---src-pages-admin-js-062b57a9a01265139788.js
/component---src-pages-adview-js-0d97ae711b6e1f08ea78.js
/component---src-pages-bid-js-14909a71e51611afe0ee.js
/component---src-pages-confirm-user-js-c7a0e3a7e990f15f56c3.js
/component---src-pages-contact-js-8ea69f43c706a2b77ec8.js
/component---src-pages-index-js-3c19039f4cd8984134d6.js
/component---src-pages-legal-js-a0609ffc141341360a68.js
/component---src-pages-login-js-1867d8743313b5d8ac17.js
/component---src-pages-mailbox-js-4c8750911f2b4e4fe643.js
/component---src-pages-my-ads-js-aa5fcdc43941ac81af89.js
/component---src-pages-my-bids-js-628399917b40caecf06f.js
/component---src-pages-password-recovery-js-a79262be42fb3f27e5d8.js
/component---src-pages-register-social-js-ba3d1b6c9af8253f9143.js
/component---src-pages-register-js-c0d6ee959a9d6296b3b0.js
/component---src-pages-search-js-9161a880900f1b01698e.js

So, while you may be correct that there is no JavaScript “added” beyond what Gatsby includes, Gatsby includes plenty of JavaScript.