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

**URL:** <https://discourse.gohugo.io/t/is-it-possible-to-remove-google-infestation-from-my-hugo-site/42878>\
**Category:** support\
**Tags:** google\
**Created:** [February 9, 2023, 5:38pm UTC](https://discourse.gohugo.io/t/is-it-possible-to-remove-google-infestation-from-my-hugo-site/42878 "2023-02-09T17:38:57Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![spacedrone808](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/spacedrone808/32/14971_2.png) [@spacedrone808](https://discourse.gohugo.io/u/spacedrone808)\
**Post date:** [February 9, 2023, 5:38pm UTC](https://discourse.gohugo.io/t/is-it-possible-to-remove-google-infestation-from-my-hugo-site/42878/1 "2023-02-09T17:38:57Z")

</div>

Providing uMatrix output to see what i mean:

 ![Untitled](https://canada1.discourse-cdn.com/flex036/uploads/gohugo/original/3X/4/9/496bba4b3c1f803f1631aa82f69f9d40bd20ce24.png)

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

Any ideas on this?

**[Link to website](https://trackerninja.codeberg.page)**

---

<div class="post-metadata">

**Author:** ![bwintx](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/bwintx/32/10450_2.png) [@bwintx](https://discourse.gohugo.io/u/bwintx)\
**Post date:** [February 9, 2023, 5:52pm UTC](https://discourse.gohugo.io/t/is-it-possible-to-remove-google-infestation-from-my-hugo-site/42878/2 "2023-02-09T17:52:51Z")

</div>

1. Self-host your fonts rather than get them from Google:  
[Good stuff without&nbsp;Google | BryceWray.com](https://www.brycewray.com/posts/2020/08/good-stuff-without-google/)

2. Use an analytics provider other than Google Analytics. I recommend [Fathom Analytics](https://usefathom.com/ref/ZKHYWX)\*, but some prefer [Plausible Analytics](https://plausible.io).

\* 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.

---

<div class="post-metadata">

**Author:** ![spacedrone808](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/spacedrone808/32/14971_2.png) [@spacedrone808](https://discourse.gohugo.io/u/spacedrone808)\
**Post date:** [February 9, 2023, 5:56pm UTC](https://discourse.gohugo.io/t/is-it-possible-to-remove-google-infestation-from-my-hugo-site/42878/3 "2023-02-09T17:56:09Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![bwintx](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/bwintx/32/10450_2.png) [@bwintx](https://discourse.gohugo.io/u/bwintx)\
**Post date:** [February 9, 2023, 5:59pm UTC](https://discourse.gohugo.io/t/is-it-possible-to-remove-google-infestation-from-my-hugo-site/42878/4 "2023-02-09T17:59:27Z")

</div>

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

```auto
<link rel="dns-prefetch" href="//fonts.googleapis.com">
<link rel="dns-prefetch" href="//fonts.gstatic.com">
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Open+Sans:400,400i,700">

```

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

```auto
https://fonts.gstatic.com/s/opensans/v34/memvYaGs126MiZpBA-UvWbX2vVnXBbObj2OVTS-mu0SC55I.woff2

```

🤷

---

<div class="post-metadata">

**Author:** ![spacedrone808](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/spacedrone808/32/14971_2.png) [@spacedrone808](https://discourse.gohugo.io/u/spacedrone808)\
**Post date:** [February 9, 2023, 6:11pm UTC](https://discourse.gohugo.io/t/is-it-possible-to-remove-google-infestation-from-my-hugo-site/42878/5 "2023-02-09T18:11:14Z")

</div>

> [@bwintx](#):
>
> I based the note about fonts from your graphic.

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.

---

<div class="post-metadata">

**Author:** ![spacedrone808](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/spacedrone808/32/14971_2.png) [@spacedrone808](https://discourse.gohugo.io/u/spacedrone808)\
**Post date:** [February 9, 2023, 6:57pm UTC](https://discourse.gohugo.io/t/is-it-possible-to-remove-google-infestation-from-my-hugo-site/42878/6 "2023-02-09T18:57:30Z")

</div>

Removed lines:

```auto
{{- $googleFontsLink := .Site.Params.googleFontsLink | default "https://fonts.googleapis.com/css?family=Open+Sans:400,400i,700" }}
	{{- if hasPrefix $googleFontsLink "https://fonts.googleapis.com/" }}
        <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
	<link rel="dns-prefetch" href="//fonts.googleapis.com">
	<link rel="dns-prefetch" href="//fonts.gstatic.com">
	<link rel="stylesheet" {{ printf `href="%s"` $googleFontsLink | safeHTMLAttr }}>
	{{- end }}

```

**AND**

```auto
{{- 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 [doubleclick.net](http://doubleclick.net) 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…

---

<div class="post-metadata">

**Author:** ![jmooring](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/jmooring/32/4214_2.png) [@jmooring](https://discourse.gohugo.io/u/jmooring)\
**Post date:** [February 9, 2023, 7:08pm UTC](https://discourse.gohugo.io/t/is-it-possible-to-remove-google-infestation-from-my-hugo-site/42878/7 "2023-02-09T19:08:56Z")

</div>

Do you have this in your site configuration?

```auto
[privacy.youtube]
privacyEnhanced = true

```

[https://gohugo.io/about/hugo-and-gdpr/#all-privacy-settings](https://gohugo.io/about/hugo-and-gdpr/#all-privacy-settings)

---

<div class="post-metadata">

**Author:** ![spacedrone808](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/spacedrone808/32/14971_2.png) [@spacedrone808](https://discourse.gohugo.io/u/spacedrone808)\
**Post date:** [February 9, 2023, 7:16pm UTC](https://discourse.gohugo.io/t/is-it-possible-to-remove-google-infestation-from-my-hugo-site/42878/8 "2023-02-09T19:16:04Z")

</div>

> [@jmooring](#):
>
> Do you have this in your site configuration?

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

---

<div class="post-metadata">

**Author:** ![system](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/system/32/1_2.png) [@system](https://discourse.gohugo.io/u/system)\
**Post date:** [February 11, 2023, 7:16pm UTC](https://discourse.gohugo.io/t/is-it-possible-to-remove-google-infestation-from-my-hugo-site/42878/9 "2023-02-11T19:16:20Z")

</div>

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