Skip to content

Commit

Permalink
Add support for Google Analytics GA4
Browse files Browse the repository at this point in the history
Fixes EmielH#66
  • Loading branch information
cloudlena committed Dec 7, 2022
1 parent d6c8e81 commit b3bc7c6
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 7 deletions.
17 changes: 11 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -103,25 +103,29 @@ Feel free to submit pull requests for other translations of Tale's texts.
[Hugo documentation for multilingual sites](//gohugo.io/content-management/multilingual/)

### Disqus

Tale supports Disqus integration, a comment system that empowers dynamic features to static websites. To install it, just add the key `disqusShortname` in your `config.toml`
``` toml

```toml
disqusShortname = "disqus-example"
```
Add the parameter `comments` in the front-matter of the pages where you want to allow comments
```
```

Add the parameter `comments` in the front-matter of the pages where you want to allow comments

```
---
comments: true
---
```

### Google Analytics

Tale supports Google Analytics integration using Hugo's provided `google_analytics_async` template.
Tale supports Google Analytics (UA and GA4) integration using Hugo's provided `google_analytics` template.

To enable it, add the `googleAnalytics` tag to your `config.toml`. It will be added on all pages.

```toml
googleAnalytics = "UA-133700000-0"
googleAnalytics = "UA-133700000-0" # or G-1337000000 for GA4
```

### Custom summaries
Expand Down Expand Up @@ -179,4 +183,5 @@ Thanks
- to [lucperkins](https://github.com/lucperkins) for the [Fresh theme](https://github.com/lucperkins/hugo-fresh) from which I used some useful snippets of code.

## License

See [LICENSE](https://github.com/EmielH/tale-hugo/blob/master/LICENSE).
2 changes: 1 addition & 1 deletion layouts/partials/head.html
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<head>
<!-- Google Analytics -->
{{ template "_internal/google_analytics_async.html" . }}
{{ template "_internal/google_analytics.html" . }}
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
{{- if .IsHome }}
Expand Down

0 comments on commit b3bc7c6

Please sign in to comment.