Add fathom analytics (#200)
Co-authored-by: Dillon <dillonzq@outlook.com>
This commit is contained in:
@@ -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 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
|
* Optimized SEO performance with a correct **SEO SCHEMA** based on JSON-LD
|
||||||
* [**Google Analytics**](https://analytics.google.com/analytics) supported
|
* [**Google Analytics**](https://analytics.google.com/analytics) supported
|
||||||
|
* [**Fathom Analytics**](https://usefathom.com/) supported
|
||||||
* Search engine **verification** supported (Google, Bind, Yandex and Baidu)
|
* Search engine **verification** supported (Google, Bind, Yandex and Baidu)
|
||||||
* **CDN** for third-party libraries supported
|
* **CDN** for third-party libraries supported
|
||||||
* Automatically converted images with **Lazy Load** by [lazysizes](https://github.com/aFarkas/lazysizes)
|
* Automatically converted images with **Lazy Load** by [lazysizes](https://github.com/aFarkas/lazysizes)
|
||||||
|
|||||||
@@ -782,6 +782,11 @@ enableEmoji = true
|
|||||||
yandex = ""
|
yandex = ""
|
||||||
pinterest = ""
|
pinterest = ""
|
||||||
baidu = ""
|
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 and JS Files CDN
|
||||||
# CSS 和 JS 文件的 CDN 设置
|
# CSS 和 JS 文件的 CDN 设置
|
||||||
[params.cdn]
|
[params.cdn]
|
||||||
|
|||||||
@@ -264,4 +264,8 @@
|
|||||||
{{- /* Google analytics async */ -}}
|
{{- /* Google analytics async */ -}}
|
||||||
{{- if eq hugo.Environment "production" | and .Site.GoogleAnalytics -}}
|
{{- if eq hugo.Environment "production" | and .Site.GoogleAnalytics -}}
|
||||||
{{- template "_internal/google_analytics_async.html" . -}}
|
{{- template "_internal/google_analytics_async.html" . -}}
|
||||||
{{- end -}}
|
|
||||||
|
{{ if and .Site.Params.fathomAnalytics .Site.Params.fathomAnalytics.siteID }}
|
||||||
|
{{- partial "plugin/analytics/fathom" . -}}
|
||||||
|
{{ end }}
|
||||||
|
{{- end -}}
|
||||||
13
layouts/partials/plugin/analytics/fathom.html
Normal file
13
layouts/partials/plugin/analytics/fathom.html
Normal 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>
|
||||||
Reference in New Issue
Block a user