Skip to content

Commit

Permalink
Add plausible analytics template and configuration
Browse files Browse the repository at this point in the history
Co-authored-by: Laure Thompson <[email protected]>
  • Loading branch information
rlskoeser and laurejt committed Oct 8, 2024
1 parent 6671ea6 commit 56ca6bb
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 0 deletions.
5 changes: 5 additions & 0 deletions config/_default/config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,11 @@ params:
ISSN: 2694-2658
googleSiteVerification: pS2kpksxg6JeC90IvA8BHVsFuK_6b7J_vARVLqqu7ck
absoluteArticleLinks: false
plausible:
domain: startwords.cdh.princeton.edu
script: https://plausible.io/js/script.file-downloads.hash.outbound-links.js
notfound: true


defaultContentLang: en

Expand Down
1 change: 1 addition & 0 deletions themes/startwords/layouts/_default/baseof.html
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@
<script defer src="{{ $js.RelPermalink }}"></script>
{{- if hugo.IsProduction -}}
{{ partial "partials/google_analytics.html" . }}
{{ partial "partials/plausible_analytics.html" . }}
{{- end -}}
{{- if or (.HasShortcode "deepzoom") (isset .Page.Params "needs_deepzoom") }}{{/* include openseadragon when deepzoom shortcode is used or requested in page params */}}
<script defer src="https://cdn.jsdelivr.net/npm/[email protected]/build/openseadragon/openseadragon.min.js" integrity="sha256-NMxPj6Qf1CWCzNQfKoFU8Jx18ToY4OWgnUO1cJWTWuw=" crossorigin="anonymous"></script>
Expand Down
7 changes: 7 additions & 0 deletions themes/startwords/layouts/partials/plausible_analytics.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{{- if isset site.Params "plausible" }}
{{/* plausible analytics */}}
<script defer data-domain="{{ site.Params.plausible.domain }}" src="{{ site.Params.plausible.script }} "></script>
{{- if isset site.Params.plausible "notfound" }}
<script>window.plausible = window.plausible || function() { (window.plausible.q = window.plausible.q || []).push(arguments) }</script>
{{- end }}
{{- end }}

0 comments on commit 56ca6bb

Please sign in to comment.