Add statcounter to statistics (#1003)

This commit is contained in:
David G. Simmons 2024-10-21 09:11:26 -04:00 committed by GitHub
parent 2f670db6a0
commit aa9b49b318
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 27 additions and 4 deletions

View file

@ -93,7 +93,7 @@ params:
# Enable dark theme # Enable dark theme
darkMode: darkMode:
# [Deprecated] Enable dark theme # [Deprecated] Enable dark theme
# This is a deprecated setting, but has not been removed to maintain backward compatibility # This is a deprecated setting, but has not been removed to maintain backward compatibility
# If `theme` is set, the `darkMode` setting will be discarded. # If `theme` is set, the `darkMode` setting will be discarded.
@ -192,7 +192,11 @@ params:
# scheme: https # scheme: https
# instance: umami.example.com # instance: umami.example.com
# id: <your umami site id> # id: <your umami site id>
# # Statcounter
# statcounter:
# project: 1234567890
# invisible: 1
# security: deadbeef
# Enable Support # Enable Support
support: support:
enable: false enable: false
@ -287,7 +291,7 @@ params:
plyr: plyr:
# options doc: https://github.com/sampotts/plyr#options # options doc: https://github.com/sampotts/plyr#options
# fullscreen: true # fullscreen: true
# Enables copy code button # Enables copy code button
copyCodeButton: copyCodeButton:
enable: true enable: true

View file

@ -8,7 +8,7 @@
{{ template "_internal/twitter_cards.html" . }} {{ template "_internal/twitter_cards.html" . }}
<!------ ADD PAGE SPECIFIC HEADERS -------> <!------ ADD PAGE SPECIFIC HEADERS ------->
{{ block "header" . }} {{ end }} {{ block "header" . }} {{ end }}
<!--================= add analytics if enabled =========================--> <!--================= add analytics if enabled =========================-->
{{- partial "analytics.html" . -}} {{- partial "analytics.html" . -}}
<script> <script>

View file

@ -57,6 +57,25 @@
<script defer src='{{ or .scheme "https" }}://{{ or .instance "analytics.eu.umami.is" }}/script.js' data-website-id="{{ .id }}"></script> <script defer src='{{ or .scheme "https" }}://{{ or .instance "analytics.eu.umami.is" }}/script.js' data-website-id="{{ .id }}"></script>
<!-- End Umami analytics --> <!-- End Umami analytics -->
{{end}} {{end}}
{{ with .statcounter }}
<!-- Statcounter analytics -->
<script type="text/javascript" src="https://www.statcounter.com/counter/counter.js" async></script>
<script type="text/javascript">
var sc_project = {{ .project }};
var sc_invisible = {{ .invisible }};
var sc_security = "{{ .security }}";
var scJsHost = (("https:" == document.location.protocol) ?
"https://www.statcounter.com/js/" : "https://www.statcounter.com/js/");
</script>
<noscript>
<div class="statcounter"><a title="web counter" href="https://statcounter.com/" target="_blank"><img
class="statcounter" src="https://c.statcounter.com/{{ .project }}/0/{{ .security }}/{{ .invisible }}/"
alt="web counter" referrerPolicy="no-referrer-when-downgrade"></a></div>
<!-- End of Statcounter Code -->
</noscript>
<!-- End Statcounter analytics -->
{{ end }}
{{ end }} {{ end }}
{{ end }} {{ end }}
{{ end }} {{ end }}