Is it possible to remove google infestation from my Hugo site?

Providing uMatrix output to see what i mean:

I’m using custom fonts.
Just want to simplify website for unneeded requests to third parties.

Any ideas on this?

Link to website

  1. Self-host your fonts rather than get them from Google:
    Good stuff without Google |

  2. Use an analytics provider other than Google Analytics. I recommend Fathom Analytics*, but some prefer Plausible Analytics.

* Full disclosure: that’s an affiliate link. If you sign up with Fathom after doing the free trial by using that link, you’ll get a discount and I’ll receive a small commission.

Thanks for answer. I’m not using google fonts, custom fonts are loading from my website.
And i don’t need any analytics whatsoever.

1 Like

I based the note about fonts from your graphic. But, to be sure, this comes from the source code of your link:

<link rel="dns-prefetch" href="//">
<link rel="dns-prefetch" href="//">
<link rel="stylesheet" href=",400i,700">

… and from the browser’s Network tab checking for fonts:



Aha, i get it. Thank you so much!
There are unneeded requests in css file regarding fonts and analytics.
But i need to investigate more, i don’t think that this will be so easy to solve.

1 Like

Removed lines:

{{- $googleFontsLink := .Site.Params.googleFontsLink | default ",400i,700" }}
	{{- if hasPrefix $googleFontsLink "" }}
        <link rel="preconnect" href="" crossorigin>
	<link rel="dns-prefetch" href="//">
	<link rel="dns-prefetch" href="//">
	<link rel="stylesheet" {{ printf `href="%s"` $googleFontsLink | safeHTMLAttr }}>
	{{- end }}


{{- if not .Site.IsServer }}
		{{- if hasPrefix .Site.GoogleAnalytics "G-" }}
		{{ template "_internal/google_analytics.html" . }}
		{{- else }}
		{{ template "_internal/google_analytics_async.html" . }}
		{{- end }}
	{{- end }}

But still getting requests, google analytics, gstatic and gfonts on pages with youtube videos, where {{<youtube >}} code is used. On plain pages with text and images requests disappeared.

It looks like there is no easy way to get rid of that…

Do you have this in your site configuration?

privacyEnhanced = true


Ohaaa, that was super helpful!
Thanks for pointing out. Strange thing that i didn’t find it by myself [lazy bastard].

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.