From abc1133c7e077d484e4c97f75cee8460a3004397 Mon Sep 17 00:00:00 2001 From: Eltjo Date: Wed, 22 Jun 2022 16:50:56 +0200 Subject: Adds Azure Application Insights as a new analytics option (#692) * Added Application Insights * Added entry to contributes * Added new line at end of the file * Updated configurations.md Co-authored-by: Eltjo Veninga --- CONTRIBUTORS.md | 1 + docs/configurations.md | 9 +++++++++ exampleSite/config.toml | 4 ++++ layouts/_default/baseof.html | 4 ++++ layouts/partials/analytics/applicationinsights.html | 13 +++++++++++++ 5 files changed, 31 insertions(+) create mode 100644 layouts/partials/analytics/applicationinsights.html diff --git a/CONTRIBUTORS.md b/CONTRIBUTORS.md index c7c0e5a..e5f88ca 100644 --- a/CONTRIBUTORS.md +++ b/CONTRIBUTORS.md @@ -112,4 +112,5 @@ - [John Feminella](https://jxf.me) - [zzsqwq](https://zzsqwq.cn) - [George Tsiokos](https://george.tsiokos.com) +- [Eltjo](https://github.com/eltjo) - [Saurmandal](https://saur.neocities.org) diff --git a/docs/configurations.md b/docs/configurations.md index 8472fb0..5e07d0b 100644 --- a/docs/configurations.md +++ b/docs/configurations.md @@ -9,6 +9,7 @@ * [Goat Counter](#goat-counter) * [Cloudflare](#cloudflare) * [Matomo](#matomo) + * [Application Insights](#application-insights) * [Commenting Systems](#commenting-systems) * [Disqus](#disqus) * [Commento](#commento) @@ -33,6 +34,7 @@ This theme supports: * [Goat Counter](https://www.goatcounter.com/) * [Cloudflare](https://www.cloudflare.com/analytics/) * [Matomo](https://matomo.org/) + * [Application Insights](https://azure.com/) * Commenting Systems * [Disqus](https://disqus.com/) * [Commento](https://commento.io/) @@ -89,6 +91,13 @@ Follow [these steps](https://gohugo.io/templates/internal/#configure-google-anal serverURL = "analytics.example.com" ``` +#### Application Insights + +```toml +[params.applicationInsights] + connectionString = "connectionstring" # https://docs.microsoft.com/en-us/azure/azure-monitor/app/sdk-connection-string +``` + ### Commenting Systems Comments are displayed within post pages, but can be disabled with `disableComments` front-matter. diff --git a/exampleSite/config.toml b/exampleSite/config.toml index cdf9479..dcc4195 100644 --- a/exampleSite/config.toml +++ b/exampleSite/config.toml @@ -69,6 +69,10 @@ customJS = [] # [params.googleTagManager] # id = "gid" +# If you want to use Application Insights(https://azure.com/) for analytics, add this section +# [params.applicationInsights] +# connectionString = "connectionString" + # 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 d29d508..19df409 100644 --- a/layouts/_default/baseof.html +++ b/layouts/_default/baseof.html @@ -65,6 +65,10 @@ {{- partial "analytics/googletagmanager" . -}} {{ end }} + {{ if and .Site.Params.applicationInsights .Site.Params.applicationInsights.connectionString }} + {{- partial "analytics/applicationinsights" . -}} + {{ end }} + {{- partial "body/extensions" . -}} diff --git a/layouts/partials/analytics/applicationinsights.html b/layouts/partials/analytics/applicationinsights.html new file mode 100644 index 0000000..72d2d18 --- /dev/null +++ b/layouts/partials/analytics/applicationinsights.html @@ -0,0 +1,13 @@ + -- cgit v1.2.3