disabled google analytics if analytics disabled

This commit is contained in:
Abubakar Abid 2022-02-07 14:26:23 -05:00
parent 4f9ab42b67
commit 9f2f5879e6
3 changed files with 5 additions and 0 deletions

View File

@ -20,7 +20,9 @@
<meta name="twitter:title" content="{{ config['title'] or '' }}">
<meta name="twitter:description" content="{{ config['simple_description'] or '' }}">
<meta name="twitter:image" content="{{ config['thumbnail'] or '' }}">
{%if config['analytics_enabled'] %}
<script async src="https://www.googletagmanager.com/gtag/js?id=UA-156449732-1"></script>
{% endif %}
<script>
window.dataLayer = window.dataLayer || [];
function gtag() {

View File

@ -195,6 +195,7 @@ def get_config_file(interface: Interface) -> Dict[str, Any]:
"show_input": interface.show_input,
"show_output": interface.show_output,
"title": interface.title,
"analytics_enabled": interface.analytics_enabled,
"description": interface.description,
"simple_description": interface.simple_description,
"article": interface.article,

View File

@ -25,10 +25,12 @@
content="{{ config['simple_description'] or '' }}"
/>
<meta name="twitter:image" content="{{ config['thumbnail'] or '' }}" />
{%if config['analytics_enabled'] %}
<script
async
src="https://www.googletagmanager.com/gtag/js?id=UA-156449732-1"
></script>
{% endif %}
<script>
window.dataLayer = window.dataLayer || [];
function gtag() {