Skip to content

Commit

Permalink
Add plausible analytics support
Browse files Browse the repository at this point in the history
Add the required script for analytics tracking using plausible
  • Loading branch information
erickgnavar committed Oct 9, 2020
1 parent 8f40b2f commit e9da194
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 0 deletions.
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,10 @@ params:
readingTimeText: "Estimated reading time:"
fathomUrl: ""
fathomSiteId: ""
plausibleAnalytics:
domain: ""
# Default value is plausible.io, overwrite this if you are self-hosting or using a custom domain
serverURL: ""

permalinks:
post: "/:year/:month/:day/:filename/"
Expand Down
5 changes: 5 additions & 0 deletions exampleSite/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,11 @@ params:
readingTimeText: "Estimated reading time:"
fathomUrl: ""
fathomSiteId: ""
# If you want to use plausible(https://plausible.io) for analytics, add this section
plausibleAnalytics:
domain: ""
# Default value is plausible.io, overwrite this if you are self-hosting or using a custom domain
serverURL: ""

permalinks:
post: "/:year/:month/:day/:filename/"
Expand Down
1 change: 1 addition & 0 deletions layouts/partials/header.html
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
{{ partial "extra-in-head.html" . }}
{{ partial "exponea.html" . }}
{{ partial "fathom.html" . }}
{{ partial "plausible.html" . }}
</head>
<body>
{{ template "_internal/google_analytics.html" . }}
Expand Down
3 changes: 3 additions & 0 deletions layouts/partials/plausible.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{{ if and .Site.Params.plausibleAnalytics .Site.Params.plausibleAnalytics.domain }}
<script async defer data-domain="{{ .Site.Params.plausibleAnalytics.domain }}" src="https://{{ .Site.Params.plausibleAnalytics.serverURL | default "plausible.io" }}/js/plausible.js"></script>
{{ end }}

0 comments on commit e9da194

Please sign in to comment.