eibiflo / cf_cookiemanager

Simple Typo3 Cookie Manager
GNU General Public License v2.0
10 stars 5 forks source link

Page Speed Insight has problems with the banner #26

Open ChristianOsswald opened 6 months ago

ChristianOsswald commented 6 months ago

image

Would be possible to set a list of bots criteria or get it from an online list to disable cookie banner?

eibiflo commented 6 months ago

The setting already exists and is available in the extension settings. (hideFromBots) If set to 1, the cookie plugin will not run when a bot/crawler/webdriver is detected. https://docs.typo3.org/p/codingfreaks/cf-cookiemanager/main/en-us/Configuration/ExtensionSettings/Index.html

This is determined based on the User Agent or the Chrome Driver. I think that if you start this through your own browser, the User Agent is still not considered a "bot". Do you have more Informations on the Request? https://github.com/eibiflo/cf_cookiemanager/blob/main/Resources/Public/JavaScript/thirdparty/consent.js#L242

ChristianOsswald commented 6 months ago

Wow, so i missed that. Super cool, it already exists. This test was through official Page Speed Insights website: https://pagespeed.web.dev/

eibiflo commented 6 months ago

Hello @ChristianOsswald , I've seen that this is an intended effect to prevent score hacking. See Pull Request Currently, there is no solution for this.

What works is if you start Lighthouse directly in the browser and modify your user agent. That's the only way I see at the moment.

Do you have any suggestions on this Topic?

ChristianOsswald commented 6 months ago

Hi @eibiflo , thanks for the quick response and research. I don't have any further ideas.

eibiflo commented 6 months ago

What I can propose is a GET parameter ?_cfHideConsent_=1 or something along those lines. Alternatively, it's also possible to create a timeout for the modal box, set to 3 seconds for testing purposes, then the FCP and LCP wouldn't be an issue. However, this isn't a real-world example since the parameters are missing in the Web Console, and one wouldn't want to wait 3-4 seconds for the modal to appear.

I'll leave this topic open for now, to see what time brings, or perhaps even better ideas will emerge.