Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add statcounter to statistics #1003

Merged
merged 5 commits into from
Oct 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions exampleSite/hugo.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ params:

# Enable dark theme
darkMode:

# [Deprecated] Enable dark theme
# This is a deprecated setting, but has not been removed to maintain backward compatibility
# If `theme` is set, the `darkMode` setting will be discarded.
Expand Down Expand Up @@ -192,7 +192,11 @@ params:
# scheme: https
# instance: umami.example.com
# id: <your umami site id>

# # Statcounter
# statcounter:
# project: 1234567890
# invisible: 1
# security: deadbeef
# Enable Support
support:
enable: false
Expand Down Expand Up @@ -287,7 +291,7 @@ params:
plyr:
# options doc: https://github.com/sampotts/plyr#options
# fullscreen: true

# Enables copy code button
copyCodeButton:
enable: true
Expand Down
2 changes: 1 addition & 1 deletion layouts/_default/baseof.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
{{ template "_internal/twitter_cards.html" . }}
<!------ ADD PAGE SPECIFIC HEADERS ------->
{{ block "header" . }} {{ end }}

<!--================= add analytics if enabled =========================-->
{{- partial "analytics.html" . -}}
<script>
Expand Down
19 changes: 19 additions & 0 deletions layouts/partials/analytics.html
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,25 @@
<script defer src='{{ or .scheme "https" }}://{{ or .instance "analytics.eu.umami.is" }}/script.js' data-website-id="{{ .id }}"></script>
<!-- End Umami analytics -->
{{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 }}
Expand Down
Loading