Pre* Hint Domains

Out of the gate, SWIS will automatically search your page for resources that are loading from external sources/domains. These might be from Google (analytics, fonts, etc.), Facebook, Instagram, or even your CDN. External resources can slow things down, because your visitor's browser has to figure out where on the great big Interwebs those resources live (DNS, like looking them up in a phone book), and then establish a connection to each of them (think dialing the phone). When SWIS finds external resources, it will add dns-prefetch and preconnect hints to tell the browser to start checking the phone book and dialing up a connection while it's working on doing other useful things.

Manual Configs

While that should all work pretty well in theory, we do limit the # of external "hint domains" to 5. So if you have more than 5 external sources, and want to make sure a particular domain gets dialed up first, you can add it to the Pre* Hint Domains setting.

Also, since we're all about flexibility, we have some tricks that developers can use to fine tune these things. These filters are available to override the default behavior.

apply_filters( 'swis_skip_preconnect', false, $domain );
apply_filters( 'swis_skip_prefetch', false, $domain );
apply_filters( 'swis_preconnect_domains', $preconnect_domains );
apply_filters( 'swis_prefetch_domains', $prefetch_domains );
apply_filters( 'swis_prefetch_max_domains', 5 ); // If you override this one, it trickles down to the next one too.
apply_filters( 'swis_preconnect_max_domains', $max_prefetch_hints ); // Notice how the default is the same as the # of prefetch hints, so you can use one filter to affect both, or adjust them individually.

Still need help? Contact Us Contact Us