mirror of
https://github.com/getpelican/pelican.git
synced 2025-10-15 20:28:56 +02:00
Generalize analytics support in default theme
As the number of privacy-preserving analytics options proliferates, it no longer makes sense to support specific solutions provided by ad-tracking corporations.
This commit is contained in:
parent
5435dd0d81
commit
639173da6b
4 changed files with 13 additions and 49 deletions
|
|
@ -67,7 +67,7 @@ Deployment
|
||||||
|
|
||||||
After you have generated your site, previewed it in your local development
|
After you have generated your site, previewed it in your local development
|
||||||
environment, and are ready to deploy it to production, you might first
|
environment, and are ready to deploy it to production, you might first
|
||||||
re-generate your site with any production-specific settings (e.g., analytics
|
re-generate your site with any production-specific settings (e.g., analytics,
|
||||||
feeds, etc.) that you may have defined::
|
feeds, etc.) that you may have defined::
|
||||||
|
|
||||||
pelican content -s publishconf.py
|
pelican content -s publishconf.py
|
||||||
|
|
|
||||||
|
|
@ -1245,18 +1245,19 @@ Feel free to use them in your themes as well.
|
||||||
Your GitHub URL (if you have one). It will then use this information to
|
Your GitHub URL (if you have one). It will then use this information to
|
||||||
create a GitHub ribbon.
|
create a GitHub ribbon.
|
||||||
|
|
||||||
.. data:: GOOGLE_ANALYTICS
|
.. data:: ANALYTICS
|
||||||
|
|
||||||
Set to ``UA-XXXXX-Y`` Property's tracking ID to activate Google Analytics.
|
Put any desired analytics scripts in this setting in ``publishconf.py``.
|
||||||
|
Example:
|
||||||
|
|
||||||
.. data:: GA_COOKIE_DOMAIN
|
.. parsed-literal::
|
||||||
|
|
||||||
Set cookie domain field of Google Analytics tracking code. Defaults to
|
ANALYTICS = """
|
||||||
``auto``.
|
<script src="/theme/js/primary-analytics.js"></script>
|
||||||
|
<script>
|
||||||
.. data:: GOSQUARED_SITENAME
|
[ … in-line Javascript code for secondary analytics … ]
|
||||||
|
</script>
|
||||||
Set to 'XXX-YYYYYY-X' to activate GoSquared.
|
"""
|
||||||
|
|
||||||
.. data:: MENUITEMS
|
.. data:: MENUITEMS
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,26 +1,3 @@
|
||||||
{% if GOOGLE_ANALYTICS %}
|
{% if ANALYTICS %}
|
||||||
<script type="text/javascript">
|
{{ ANALYTICS }}
|
||||||
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
|
|
||||||
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
|
|
||||||
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
|
|
||||||
})(window,document,'script','https://www.google-analytics.com/analytics.js','ga');
|
|
||||||
|
|
||||||
ga('create', '{{GOOGLE_ANALYTICS}}', '{{GA_COOKIE_DOMAIN if GA_COOKIE_DOMAIN else 'auto'}}');
|
|
||||||
ga('send', 'pageview');
|
|
||||||
</script>
|
|
||||||
{% endif %}
|
|
||||||
{% if GAUGES %}
|
|
||||||
<script type="text/javascript">
|
|
||||||
var _gauges = _gauges || [];
|
|
||||||
(function() {
|
|
||||||
var t = document.createElement('script');
|
|
||||||
t.type = 'text/javascript';
|
|
||||||
t.async = true;
|
|
||||||
t.id = 'gauges-tracker';
|
|
||||||
t.setAttribute('data-site-id', '{{GAUGES}}');
|
|
||||||
t.src = '//secure.gaug.es/track.js';
|
|
||||||
var s = document.getElementsByTagName('script')[0];
|
|
||||||
s.parentNode.insertBefore(t, s);
|
|
||||||
})();
|
|
||||||
</script>
|
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
|
||||||
|
|
@ -1,14 +0,0 @@
|
||||||
{% if GOSQUARED_SITENAME %}
|
|
||||||
<script type="text/javascript">
|
|
||||||
var GoSquared={};
|
|
||||||
GoSquared.acct = "{{ GOSQUARED_SITENAME }}";
|
|
||||||
(function(w){
|
|
||||||
function gs(){
|
|
||||||
w._gstc_lt=+(new Date); var d=document;
|
|
||||||
var g = d.createElement("script"); g.type = "text/javascript"; g.async = true; g.src = "https://d1l6p2sc9645hc.cloudfront.net/tracker.js";
|
|
||||||
var s = d.getElementsByTagName("script")[0]; s.parentNode.insertBefore(g, s);
|
|
||||||
}
|
|
||||||
w.addEventListener?w.addEventListener("load",gs,false):w.attachEvent("onload",gs);
|
|
||||||
})(window);
|
|
||||||
</script>
|
|
||||||
{% endif %}
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue