1
0
mirror of https://github.com/thangisme/notes.git synced 2024-12-21 11:16:39 -05:00

Add hook for GA tracking

This commit is contained in:
Patrick Marsceill 2019-02-02 12:32:04 -08:00
parent a44d3a8652
commit e12408d07b
No known key found for this signature in database
GPG Key ID: 286B93882D828F40
2 changed files with 18 additions and 1 deletions

View File

@ -31,3 +31,7 @@ aux_links:
# Color scheme currently only supports "dark" or nil (default)
color_scheme: nil
# Google Analytics Tracking (optional)
# e.g, UA-1234567-89
ga_tracking: UA-2709176-10

View File

@ -7,8 +7,21 @@
<title>{{ page.title }} - {{ site.title }}</title>
<link rel="stylesheet" href="{{ "/assets/css/just-the-docs.css" | absolute_url }}">
{% if site.ga_tracking != nil %}
<!-- Global site tag (gtag.js) - Google Analytics -->
<script async src="https://www.googletagmanager.com/gtag/js?id=UA-2709176-10"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', '{{ site.ga_tracking }}');
</script>
{% endif %}
{% if site.search_enabled != nil %}
<script type="text/javascript" src="{{ "/assets/js/vendor/lunr.min.js" | absolute_url }}"></script>
<script type="text/javascript" src="{{ "/assets/js/vendor/lunr.min.js" | absolute_url }}"></script>
{% endif %}
<script type="text/javascript" src="{{ "/assets/js/just-the-docs.js" | absolute_url }}"></script>