forked from github/pelican
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
|
||||
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::
|
||||
|
||||
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
|
||||
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
|
||||
``auto``.
|
||||
|
||||
.. data:: GOSQUARED_SITENAME
|
||||
|
||||
Set to 'XXX-YYYYYY-X' to activate GoSquared.
|
||||
ANALYTICS = """
|
||||
<script src="/theme/js/primary-analytics.js"></script>
|
||||
<script>
|
||||
[ … in-line Javascript code for secondary analytics … ]
|
||||
</script>
|
||||
"""
|
||||
|
||||
.. data:: MENUITEMS
|
||||
|
||||
|
|
|
|||
|
|
@ -1,26 +1,3 @@
|
|||
{% if GOOGLE_ANALYTICS %}
|
||||
<script type="text/javascript">
|
||||
(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>
|
||||
{% if ANALYTICS %}
|
||||
{{ ANALYTICS }}
|
||||
{% 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