Skip to content

Commit

Permalink
support analytics
Browse files Browse the repository at this point in the history
  • Loading branch information
crazyguitar committed Oct 6, 2018
1 parent 164c429 commit 7cd1bf8
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 0 deletions.
2 changes: 2 additions & 0 deletions app.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ def find_key(token):
"script-src": [
"'self'",
"*.cloudflare.com",
"*.googletagmanager.com",
"*.google-analytics.com",
"'unsafe-inline'",
"'unsafe-eval'",
],
Expand Down
13 changes: 13 additions & 0 deletions docs/_templates/layout.html
Original file line number Diff line number Diff line change
@@ -1,2 +1,15 @@
{% extends "!layout.html" %}
{%- block extrahead %}
{%- if tracking_id %}
<!-- Global site tag (gtag.js) - Google Analytics -->
<script async src="https://www.googletagmanager.com/gtag/js?id={{ tracking_id }}"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());

gtag('config', '{{ tracking_id }}');
</script>
{% endif -%}
{% endblock %}
{% set css_files = css_files + [ "_static/style.css" ] %}
1 change: 1 addition & 0 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,7 @@
# The name for this set of Sphinx documents. If None, it defaults to
# "<project> v<release> documentation".
html_title = "pysheeet"
html_context = {"tracking_id": os.environ.get("TRACKING_ID")}

# A shorter title for the navigation bar. Default is the same as html_title.
#html_short_title = None
Expand Down

0 comments on commit 7cd1bf8

Please sign in to comment.