-
Notifications
You must be signed in to change notification settings - Fork 284
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
Enable Prefetch DNS Requests on external Google services used by Site Kit #2203
Comments
@glanglois Thanks for the suggestion (and sorry for the super long delay 🤦♂️ )! We're going to look into adding DNS prefetch directives for the external services that Site Kit uses (e.g. Analytics, AdSense, Tag Manager snippets), to improve performance. Regarding any external Google services, that is rather out of scope for this plugin and IMO is more suitable in a performance plugin, for example since we are not actually loading Google fonts in the frontend in Site Kit. As such, I'd like to focus this issue on adding DNS prefetch for the services actually used by Site Kit in the frontend. |
@felixarntz Thank you for your reply. I was only thinking that Google Site Kit would perform a prefetch of connected Google services (analytics, tag manager, etc.). It's great to know that this could go in your roadmap. For any other prefetch, I agree that it's out of scope and should be handled by performance plugins. Have a great day! |
@aaemnnosttv @felixarntz I noticed that after setting up Tag Manager, we already have the |
@asvinb I think that is actually due to Analytics, not Tag Manager. WordPress automatically includes So for Tag Manager, we still need to do something about it just for the scenario that the user has only Tag Manager enabled (in the Tag Manager |
Thanks @felixarntz . IB updated to cater for Tag Manager. |
IB ✅ |
QA Update: Pass ✅Verified:
|
Feature Description
Several WP Chacing Plugins offer the possibility to connect to external sites (such as Google Fonts, Analytics, ...) to reduce DNS Lookups and improve user experience by improving loading time.
For instance, see WP Rocket documentation on their implementation: https://docs.wp-rocket.me/article/1302-prefetch-dns-requests
I would be useful if SiteKit offer directly this option as part of the plugin settings, especially to embed in one unique plugin, everything related to Google services.
Do not alter or remove anything below. The following sections will be managed by moderators only.
Acceptance criteria
dns-prefetch
directive for//www.googletagmanager.com
when the Analytics tag or Tag Manager tag is placed.dns-prefetch
directive for//pagead2.googlesyndication.com
when the AdSense tag is placed.wp_resource_hints
filter should be used.Implementation Brief
includes/Modules/AdSense/Web_Tag.php
,wp_resource_hints
filter to add//pagead2.googlesyndication.com
to the list of urls if the relation type isdns-prefetch
.includes/Modules/Tag_Manager/Web_Tag.php
,wp_resource_hints
filter to add//www.googletagmanager.com
to the list of urls if the relation type isdns-prefetch
.Test Coverage
Visual Regression Changes
QA Brief
Analytics
module.<link rel='dns-prefetch' href='//www.googletagmanager.com' />
Analytics
module, connect and activate theTag Manager
module.<link rel='dns-prefetch' href='//www.googletagmanager.com' />
AdSense
module.<link rel='dns-prefetch' href='//pagead2.googlesyndication.com' />
Changelog entry
The text was updated successfully, but these errors were encountered: