diff options
author | Justin Mayer <entroP@gmail.com> | 2023-04-03 10:34:05 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-04-03 10:34:05 +0200 |
commit | f96a8964bdcff729a5edc33e2ed1abdb27c24e46 (patch) | |
tree | e38115abc3bfc15462cce9580b327ff1662dc701 | |
parent | 3f004b83b694b30a20548c2b929610bd8317e706 (diff) | |
parent | 14ac9be18a3d0a88e581c7299a15f31bc77d85b9 (diff) | |
download | pelican-themes-f96a8964bdcff729a5edc33e2ed1abdb27c24e46.tar.gz |
Merge pull request #738 from srininara/gtag-support
-rw-r--r-- | pelican-bootstrap3/templates/base.html | 3 | ||||
-rw-r--r-- | pelican-bootstrap3/templates/includes/article_info.html | 3 | ||||
-rw-r--r-- | pelican-bootstrap3/templates/includes/ga.html | 26 |
3 files changed, 18 insertions, 14 deletions
diff --git a/pelican-bootstrap3/templates/base.html b/pelican-bootstrap3/templates/base.html index af2f0f9..cb673d0 100644 --- a/pelican-bootstrap3/templates/base.html +++ b/pelican-bootstrap3/templates/base.html @@ -113,6 +113,8 @@ title="{{ SITENAME }} {{ category }} ATOM Feed"/> {%- endif %} + {% include 'includes/ga.html' %} + </head> <body> @@ -232,7 +234,6 @@ {% endif %} {% include 'includes/sidebar/github-js.html' %} {% include 'includes/disqus_script.html' %} -{% include 'includes/ga.html' %} {% include 'includes/piwik.html' %} {% if 'liquid_tags.notebook' in PLUGINS %} diff --git a/pelican-bootstrap3/templates/includes/article_info.html b/pelican-bootstrap3/templates/includes/article_info.html index 1cb85d5..8ff2d12 100644 --- a/pelican-bootstrap3/templates/includes/article_info.html +++ b/pelican-bootstrap3/templates/includes/article_info.html @@ -1,4 +1,7 @@ <footer class="post-info"> + {% if article.readtime %} + <span class="label label-success">{{article.readtime.minutes}} min. read</span> + {% endif %} <span class="label label-default">Date</span> <span class="published"> <i class="fa fa-calendar"></i><time datetime="{{ article.date.isoformat() }}"> {{ article.locale_date }}</time> diff --git a/pelican-bootstrap3/templates/includes/ga.html b/pelican-bootstrap3/templates/includes/ga.html index 8663e73..c0c3425 100644 --- a/pelican-bootstrap3/templates/includes/ga.html +++ b/pelican-bootstrap3/templates/includes/ga.html @@ -1,21 +1,21 @@ {% if GOOGLE_ANALYTICS %} <!-- Google Analytics --> - <script type="text/javascript"> - - var _gaq = _gaq || []; - _gaq.push(['_setAccount', '{{ GOOGLE_ANALYTICS }}']); - _gaq.push(['_trackPageview']); + <script async src="https://www.googletagmanager.com/gtag/js?id={{ GOOGLE_ANALYTICS }}"></script> + <script> + window.dataLayer = window.dataLayer || []; + function gtag(){dataLayer.push(arguments);} + gtag('js', new Date()); - (function () { - var ga = document.createElement('script'); - ga.type = 'text/javascript'; - ga.async = true; - ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js'; - var s = document.getElementsByTagName('script')[0]; - s.parentNode.insertBefore(ga, s); - })(); + gtag('config', {{ GOOGLE_ANALYTICS }}); </script> <!-- End Google Analytics Code --> + <!-- Google Tag Manager --> + <script>(function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start': + new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0], + j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src= + 'https://www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f); + })(window,document,'script','dataLayer','{{ GA_GTM_CONTAINER_ID }}');</script> + <!-- End Google Tag Manager --> {% endif %} {% if GOOGLE_ANALYTICS_UNIVERSAL %} <!-- Google Analytics Universal --> |