mirror of
https://github.com/dillonzq/LoveIt.git
synced 2025-03-21 22:38:52 +01:00
Add fathom analytics (#200)
Co-authored-by: Dillon <dillonzq@outlook.com>
This commit is contained in:
parent
f14301c395
commit
a5d0b9a3eb
4 changed files with 24 additions and 1 deletions
|
@ -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)
|
||||
|
|
|
@ -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]
|
||||
|
|
|
@ -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 -}}
|
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>
|
Loading…
Add table
Reference in a new issue