diff --git a/CONTRIBUTORS.md b/CONTRIBUTORS.md index 9a53e14..8c9faa5 100644 --- a/CONTRIBUTORS.md +++ b/CONTRIBUTORS.md @@ -94,3 +94,4 @@ - [Alex Miranda](https://ammiranda.com) - [Alphonse Mariya](https://github.com/alfunx) - [Ziwei Pan](https://github.com/PanZiwei/) +- [Viktar Patotski](https://github.com/xp-vit) diff --git a/exampleSite/config.toml b/exampleSite/config.toml index fb1c55f..7b05b4e 100644 --- a/exampleSite/config.toml +++ b/exampleSite/config.toml @@ -87,6 +87,10 @@ disqusShortname = "yourdiscussshortname" # For cloud-hosting, use provided URL, e.g. example.matomo.cloud serverURL = "analytics.example.com" +# If you want to use Google Tag Manager(https://analytics.google.com/) for analytics, add this section +[params.googleTagManager] + id = "gid" + # If you want to implement a Content-Security-Policy, add this section [params.csp] childsrc = ["'self'"] diff --git a/layouts/_default/baseof.html b/layouts/_default/baseof.html index 9bb1a56..bf31a81 100644 --- a/layouts/_default/baseof.html +++ b/layouts/_default/baseof.html @@ -147,6 +147,10 @@ {{ if and .Site.Params.matomo .Site.Params.matomo.serverURL }} {{- partial "analytics/matomo" . -}} {{ end }} + + {{ if and .Site.Params.googleTagManager .Site.Params.googleTagManager.id }} + {{- partial "analytics/googletagmanager" . -}} + {{ end }} diff --git a/layouts/partials/analytics/googletagmanager.html b/layouts/partials/analytics/googletagmanager.html new file mode 100644 index 0000000..2d2581d --- /dev/null +++ b/layouts/partials/analytics/googletagmanager.html @@ -0,0 +1,9 @@ + + +