# .Site.GoogleAnalytics was deprecated in Hugo v0.120.0 and will be removed in Hugo 0.134.0

**URL:** <https://discourse.gohugo.io/t/site-googleanalytics-was-deprecated-in-hugo-v0-120-0-and-will-be-removed-in-hugo-0-134-0/51395>\
**Category:** support\
**Created:** [September 2, 2024, 8:23am UTC](https://discourse.gohugo.io/t/site-googleanalytics-was-deprecated-in-hugo-v0-120-0-and-will-be-removed-in-hugo-0-134-0/51395 "2024-09-02T08:23:01Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![WangYuHang-cmd](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/wangyuhang-cmd/32/22813_2.png) [@WangYuHang-cmd](https://discourse.gohugo.io/u/WangYuHang-cmd)\
**Post date:** [September 2, 2024, 8:23am UTC](https://discourse.gohugo.io/t/site-googleanalytics-was-deprecated-in-hugo-v0-120-0-and-will-be-removed-in-hugo-0-134-0/51395/1 "2024-09-02T08:23:01Z")

</div>

Hi techies, I just got into Hugo, I directly referenced the Hugo blox template, but when I edited it locally I got the following error: ERROR deprecated: .Site.GoogleAnalytics was deprecated in Hugo v0.120.0 and will be removed in Hugo 0.134.0. Use .Site.Config.Services.GoogleAnalytics.ID instead.  
I would like to know how to fix it.

---

<div class="post-metadata">

**Author:** ![davidsneighbour](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/davidsneighbour/32/24507_2.png) [@davidsneighbour](https://discourse.gohugo.io/u/davidsneighbour)\
**Post date:** [September 2, 2024, 12:07pm UTC](https://discourse.gohugo.io/t/site-googleanalytics-was-deprecated-in-hugo-v0-120-0-and-will-be-removed-in-hugo-0-134-0/51395/2 "2024-09-02T12:07:56Z")

</div>

Use your editor to search for “GoogleAnalytics” (no space) in your layout files. Those are the files in the folder `layouts`. Once found, replace any occurrence of `.Site.GoogleAnalytics` with `.Site.Config.Services.GoogleAnalytics.ID`.

Then search within `config` for `GoogleAnalytics` and take note of your ID. Then add a new section (it’s hard to say where without knowing your config file, get back here if it doesn’t work, try adding it at the end) to your configuration:

```toml
[services.googleAnalytics]
id = 'GA-YOURID'

```

see [Config | Hugo](https://gohugo.io/methods/site/config/#services)

You can probably remove the existing deprecated configuration if it’s there.

Then rebuild your site and see if it worked. If not, feel free to get back here with more explicit examples of the code where `GoogleAnalytics` is used.

---

<div class="post-metadata">

**Author:** ![WangYuHang-cmd](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/wangyuhang-cmd/32/22813_2.png) [@WangYuHang-cmd](https://discourse.gohugo.io/u/WangYuHang-cmd)\
**Post date:** [September 2, 2024, 5:04pm UTC](https://discourse.gohugo.io/t/site-googleanalytics-was-deprecated-in-hugo-v0-120-0-and-will-be-removed-in-hugo-0-134-0/51395/4 "2024-09-02T17:04:49Z")

</div>

Thanks for the reply, but I didn’t search for the property named .Site.GoogleAnalytics. How should this be handled?

 ![image](https://canada1.discourse-cdn.com/flex036/uploads/gohugo/original/3X/2/b/2bbc1eb459925338d40282251cfaa27c133701cf.png)

---

<div class="post-metadata">

**Author:** ![davidsneighbour](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/davidsneighbour/32/24507_2.png) [@davidsneighbour](https://discourse.gohugo.io/u/davidsneighbour)\
**Post date:** [September 3, 2024, 7:01am UTC](https://discourse.gohugo.io/t/site-googleanalytics-was-deprecated-in-hugo-v0-120-0-and-will-be-removed-in-hugo-0-134-0/51395/5 "2024-09-03T07:01:50Z")

</div>

Check the template where you find `GoogleAnalytics` and post here. It seems the theme developer uses the value of `marketing.analytics` instead and you won’t need to delete anything.

---

<div class="post-metadata">

**Author:** ![irkode](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/irkode/32/26135_2.png) [@irkode](https://discourse.gohugo.io/u/irkode)\
**Post date:** [September 3, 2024, 9:36am UTC](https://discourse.gohugo.io/t/site-googleanalytics-was-deprecated-in-hugo-v0-120-0-and-will-be-removed-in-hugo-0-134-0/51395/6 "2024-09-03T09:36:44Z")

</div>

For me this sounds like the theme is not compatible with your used hugo version.

- Check your hugo version and the one the theme states. Use that one if yours is newer.

- Maybe your module is not the theme is not up to date.

> [@Theme layout does not have any effect](https://discourse.gohugo.io/t/theme-layout-does-not-have-any-effect/50593/3):
>
> You are more likely to receive an accurate and timely response from the Hugo Blox team:  
> [https://github.com/HugoBlox/hugo-blox-builder/discussions](https://github.com/HugoBlox/hugo-blox-builder/discussions)
> 
> They also have an active Discord channel:  
> [https://discord.com/invite/z8wNYzb](https://discord.com/invite/z8wNYzb)
> 
> cc: @alcarazr

---

<div class="post-metadata">

**Author:** ![alcarazr](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/alcarazr/32/11576_2.png) [@alcarazr](https://discourse.gohugo.io/u/alcarazr)\
**Post date:** [September 4, 2024, 6:53am UTC](https://discourse.gohugo.io/t/site-googleanalytics-was-deprecated-in-hugo-v0-120-0-and-will-be-removed-in-hugo-0-134-0/51395/7 "2024-09-04T06:53:24Z")

</div>

> [@irkode](#):
>
> For me this sounds like the theme is not compatible with your used hugo version.

[Hugo Blox is the process of being updated](https://github.com/HugoBlox/hugo-blox-builder/pull/3139).

---

<div class="post-metadata">

**Author:** ![irkode](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/irkode/32/26135_2.png) [@irkode](https://discourse.gohugo.io/u/irkode)\
**Post date:** [September 4, 2024, 7:21am UTC](https://discourse.gohugo.io/t/site-googleanalytics-was-deprecated-in-hugo-v0-120-0-and-will-be-removed-in-hugo-0-134-0/51395/8 "2024-09-04T07:21:36Z")

</div>

This for me means:

- wait for the new hugo release where the mentioned issue is merged. Then update your theme.

- use 132- for now

I wouldn’t hazzle with adjusting the theme templates unless you have an urgent need for 133+ features
