# Add google analytics

**URL:** <https://discourse.gohugo.io/t/add-google-analytics/44211>\
**Category:** support\
**Created:** [May 4, 2023, 11:08pm UTC](https://discourse.gohugo.io/t/add-google-analytics/44211 "2023-05-04T23:08:38Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Nedjma\_Media](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/nedjma_media/32/18929_2.png) [@Nedjma\_Media](https://discourse.gohugo.io/u/Nedjma_Media)\
**Post date:** [May 4, 2023, 11:08pm UTC](https://discourse.gohugo.io/t/add-google-analytics/44211/1 "2023-05-04T23:08:38Z")

</div>

Good evening

I followed this [tutorial](https://digitaldrummerj.me/hugo-google-analytics/) which explains to add the feed id in config.toml and add:` {{ template "_internal/google_analytics.html" . }}`  
in the head I have a problem because my site is online and I can’t find config.toml in my server files for this same site!

should I do these steps (adding google analytics) locally then deploy my site online?

---

<div class="post-metadata">

**Author:** ![antoinentl](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/antoinentl/32/12914_2.png) [@antoinentl](https://discourse.gohugo.io/u/antoinentl)\
**Post date:** [May 5, 2023, 12:58am UTC](https://discourse.gohugo.io/t/add-google-analytics/44211/2 "2023-05-05T00:58:36Z")

</div>

Yes you have to modify your site locally and then deploy the generated files.

---

<div class="post-metadata">

**Author:** ![Arif](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/arif/32/20931_2.png) [@Arif](https://discourse.gohugo.io/u/Arif)\
**Post date:** [May 5, 2023, 7:13am UTC](https://discourse.gohugo.io/t/add-google-analytics/44211/3 "2023-05-05T07:13:29Z")

</div>

@Nedjma_Media if you don’t need any advertising stats, use this tutorial to configure minimal analytics

> [@Replace Hugo's inbuilt Google Analytics template with Minimal Analytics (GA4)](https://discourse.gohugo.io/t/replace-hugos-inbuilt-google-analytics-template-with-minimal-analytics-ga4/43704):
>
> This implementation is based on the following [tutorial](https://discourse.gohugo.io/t/39016) and [comment](https://discourse.gohugo.io/t/39016/2). We shall override the internal template [configuration](https://gohugo.io/templates/internal/#use-the-google-analytics-template) so that googleAnalytics value is used by our custom template instead. Create a Google Analytics file /layouts/\_internal/google\_analytics.html └───layouts └───\_internal google\_analytics.html Copy-paste the following code into it– {{- with site.GoogleAnalytics }} {{- if hugo.IsProduction }} {{- $ga4 := resources.GetRemote "https://cdn.jsdelivr.net/npm…
