add analytics support
parent
cf1dd7973e
commit
74b64c5a63
|
@ -110,6 +110,7 @@ class Config(pydantic.BaseModel):
|
|||
custom_footer: str | None = None
|
||||
emoji: str | None = None
|
||||
also_known_as: str | None = None
|
||||
ga_analytics: str | None = None
|
||||
|
||||
hides_followers: bool = False
|
||||
hides_following: bool = False
|
||||
|
|
|
@ -434,6 +434,7 @@ _templates.env.globals["JS_HASH"] = config.JS_HASH
|
|||
_templates.env.globals["CSS_HASH"] = config.CSS_HASH
|
||||
_templates.env.globals["BASE_URL"] = config.BASE_URL
|
||||
_templates.env.globals["TAGS"] = config.CONFIG.tags
|
||||
_templates.env.globals["GA_ANALYTICS"] = config.CONFIG.ga_analytics
|
||||
_templates.env.globals["HIDES_FOLLOWERS"] = config.HIDES_FOLLOWERS
|
||||
_templates.env.globals["HIDES_FOLLOWING"] = config.HIDES_FOLLOWING
|
||||
_templates.env.globals["NAVBAR_ITEMS"] = config.NavBarItems
|
||||
|
|
|
@ -1,6 +1,17 @@
|
|||
<!DOCTYPE HTML>
|
||||
<html lang="en">
|
||||
<head>
|
||||
{% if GA_ANALYTICS %}
|
||||
<!-- Google tag (gtag.js) -->
|
||||
<script async src="https://www.googletagmanager.com/gtag/js?id={{ GA_ANALYTICS }}"></script>
|
||||
<script>
|
||||
window.dataLayer = window.dataLayer || [];
|
||||
function gtag(){dataLayer.push(arguments);}
|
||||
gtag('js', new Date());
|
||||
|
||||
gtag('config', '{{ GA_ANALYTICS }}');
|
||||
</script>
|
||||
{% endif %}
|
||||
<meta charset="utf-8">
|
||||
<meta http-equiv="x-ua-compatible" content="ie=edge">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
|
||||
|
|
Loading…
Reference in New Issue