1
0
Fork 0
mirror of https://github.com/dillonzq/LoveIt.git synced 2025-03-21 22:38:52 +01:00

Add fathom analytics ()

Co-authored-by: Dillon <dillonzq@outlook.com>
This commit is contained in:
codedge 2020-04-21 17:37:05 +02:00 committed by GitHub
parent f14301c395
commit a5d0b9a3eb
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 24 additions and 1 deletions
README.md
exampleSite
layouts/partials
assets.html
plugin/analytics

View file

@ -63,6 +63,7 @@ I hope you will LoveIt ❤️!
* Optimized for **performance**: 99/100 on mobile and 100/100 on desktop in [Google PageSpeed Insights](https://developers.google.com/speed/pagespeed/insights)
* Optimized SEO performance with a correct **SEO SCHEMA** based on JSON-LD
* [**Google Analytics**](https://analytics.google.com/analytics) supported
* [**Fathom Analytics**](https://usefathom.com/) supported
* Search engine **verification** supported (Google, Bind, Yandex and Baidu)
* **CDN** for third-party libraries supported
* Automatically converted images with **Lazy Load** by [lazysizes](https://github.com/aFarkas/lazysizes)

View file

@ -782,6 +782,11 @@ enableEmoji = true
yandex = ""
pinterest = ""
baidu = ""
[params.fathomAnalytics]
# siteID = "ABC123"
# If you're self hosting use this for your tracker
# serverURL = "https://example.com"
# CSS and JS Files CDN
# CSS 和 JS 文件的 CDN 设置
[params.cdn]

View file

@ -264,4 +264,8 @@
{{- /* Google analytics async */ -}}
{{- if eq hugo.Environment "production" | and .Site.GoogleAnalytics -}}
{{- template "_internal/google_analytics_async.html" . -}}
{{- end -}}
{{ if and .Site.Params.fathomAnalytics .Site.Params.fathomAnalytics.siteID }}
{{- partial "plugin/analytics/fathom" . -}}
{{ end }}
{{- end -}}

View file

@ -0,0 +1,13 @@
<script>
(function(f, a, t, h, o, m){
a[h]=a[h]||function(){
(a[h].q=a[h].q||[]).push(arguments)
};
o=f.createElement('script'),
m=f.getElementsByTagName('script')[0];
o.async=1; o.src=t; o.id='fathom-script';
m.parentNode.insertBefore(o,m)
})(document, window, '//{{ .Site.Params.fathomAnalytics.serverURL | default "cdn.usefathom.com" }}/tracker.js', 'fathom');
fathom('set', 'siteId', '{{ .Site.Params.fathomAnalytics.siteID }}');
fathom('trackPageview');
</script>