Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Audit wrongly interprets <link rel="preload"> as duplicate tag loading #171

Open
oliverfernandez opened this issue Dec 9, 2019 · 2 comments
Assignees

Comments

@oliverfernandez
Copy link

Site: https://mejorconsalud.com

You can see an audit example here

In order to balance Lighthouse for Ads and normal Lighthouse, GPT library is preloaded using <link rel=prefetch as=script href="https://securepubads.g.doubleclick.net/tag/js/gpt.js"/> which is later converted into <script src="https://securepubads.g.doubleclick.net/tag/js/gpt.js">

With this approach, Ligthouse for Ads yields 2 issues which we consider are not accurate

  1. Tags best practices - Load tags only once per frame Here I think that Ligthouse is wrongly detecting that GPT library is being loaded twice, and if you check the network panel in Dev tools it actually appears twice, but the first one is initiated by <link rel="prefetch"> and the second one by <script> but is coming from the cache

  2. Ad speed - Load ad scripts statically Again, it seems that Lighthouse is yielding this error because our approach of using first <link rel="preload"> and later converting it to <script> But we consider this a fair approach, in order to control the initial amount of Javascript being executed and to don't penalize the Time to Interactive, or First Input Delay.

In our case, we use this approach in order to prioritize the execution of the CMP over the GPT library, in order to retreive user content, which is mandatory in Europe before start loading ads.

@warrengm
Copy link
Contributor

warrengm commented Dec 9, 2019

Thanks for raising this issue. We'll work on fixes.

For issue (1), I would expect the browser to issue only one request in your case since the request for script tag should hit the prefetch cache. But that doesn't appear to be happening here.

For some additional background on (2), we discussed similar issues in issue #128. I'll look into your site a bit further and propose a change soon.

@oliverfernandez
Copy link
Author

@warrengm Thanks! Please let me know if you need more information from my side

@jburger424 jburger424 assigned jburger424 and unassigned warrengm Dec 6, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants