File tree Expand file tree Collapse file tree 3 files changed +11
-1
lines changed Expand file tree Collapse file tree 3 files changed +11
-1
lines changed Original file line number Diff line number Diff line change @@ -53,6 +53,8 @@ theme = "light"
53
53
# google = "G-XXXXXXXXXX"
54
54
# https://plausible.io
55
55
# plausible = "data.domain"
56
+ # https://umami.is
57
+ # umami = "8d3fde60-xxxx-xxxx-xxxx-b89e7cic209c"
56
58
57
59
[twitter_card ]
58
60
enabled = false
Original file line number Diff line number Diff line change @@ -101,19 +101,21 @@ impl Object for Giscus {
101
101
pub struct Analytics {
102
102
google : Option < String > ,
103
103
plausible : Option < String > ,
104
+ umami : Option < String > ,
104
105
}
105
106
106
107
impl Object for Analytics {
107
108
fn get_value ( self : & Arc < Self > , key : & Value ) -> Option < Value > {
108
109
match key. as_str ( ) ? {
109
110
"google" => Some ( Value :: from ( self . google . clone ( ) ) ) ,
110
111
"plausible" => Some ( Value :: from ( self . plausible . clone ( ) ) ) ,
112
+ "umami" => Some ( Value :: from ( self . umami . clone ( ) ) ) ,
111
113
_ => None ,
112
114
}
113
115
}
114
116
115
117
fn enumerate ( self : & Arc < Self > ) -> Enumerator {
116
- Enumerator :: Str ( & [ "google" , "plausible" ] )
118
+ Enumerator :: Str ( & [ "google" , "plausible" , "umami" ] )
117
119
}
118
120
}
119
121
@@ -168,6 +170,9 @@ impl Config {
168
170
if let Ok ( plausible_domain) = std:: env:: var ( "PLAUSIBLE_DOMAIN" ) {
169
171
self . analytics . plausible = Some ( plausible_domain) ;
170
172
}
173
+ if let Ok ( umami_id) = std:: env:: var ( "UMAMI_ID" ) {
174
+ self . analytics . umami = Some ( umami_id) ;
175
+ }
171
176
Ok ( ( ) )
172
177
}
173
178
Original file line number Diff line number Diff line change 22
22
{% if config.analytics.plausible %}
23
23
< script defer data-domain ='{{ config.analytics.plausible }} ' src ="https://plausible.io/js/script.js "> </ script >
24
24
{% endif %}
25
+ {% if config.analytics.umami %}
26
+ < script defer src ="https://cloud.umami.is/script.js " data-website-id ="{{ config.analytics.umami }} "> </ script >
27
+ {% endif %}
25
28
{% block head %}{% endblock %}
26
29
</ head >
27
30
You can’t perform that action at this time.
0 commit comments