diff options
author | luxagraf <sng@luxagraf.net> | 2019-05-03 14:44:39 -0500 |
---|---|---|
committer | luxagraf <sng@luxagraf.net> | 2019-05-03 14:44:39 -0500 |
commit | 17c51c125898f124040b109156bdc15fa4341c2a (patch) | |
tree | c874ecbd4874d84b03fa1292f7a91cc3a3b47759 | |
parent | 6dea2fcff795f062f467fce7ed1e18c184bd5400 (diff) |
added analytics and offline support
-rw-r--r-- | TODO | 9 | ||||
-rw-r--r-- | app/blog/views.py | 1 | ||||
-rw-r--r-- | design/templates/base.html | 34 |
3 files changed, 22 insertions, 22 deletions
@@ -1,9 +1,10 @@ -* Libregraf: fix link feed so RSS reader opens source not my link * Libregraf: figure out archive structure for links (paginated? by date links to pages?) -* Libregraf: add robots.txt * Libregraf: fix sitemap bug -* Libregraf: add analytics -* Libregraf: set up email address comments@libregraf.net +* Libregraf: add awstats +* Libregraf: add awstats * Libregraf: migrate SRC to libregraf? DONE +* Libregraf: fix link feed so RSS reader opens source not my link +* Libregraf: add robots.txt +* Libregraf: set up email address comments@libregraf.net diff --git a/app/blog/views.py b/app/blog/views.py index 224decb..390d379 100644 --- a/app/blog/views.py +++ b/app/blog/views.py @@ -44,6 +44,7 @@ class HomePageView(ListView): template_name = "homepage.html" def get_queryset(self, **kwargs): + print(self.request.META.get('HTTP_X_FORWARDED_FOR', self.request.META.get('REMOTE_ADDR', '')).split(',')[-1].strip()) entry_list = Entry.objects.filter(status=1) link_list = Link.objects.filter(status=1) result_list = sorted( diff --git a/design/templates/base.html b/design/templates/base.html index 7e48bc5..20c9028 100644 --- a/design/templates/base.html +++ b/design/templates/base.html @@ -66,25 +66,23 @@ if (navigator.serviceWorker) { }); } </script> - {%comment%} -<!-- Piwik --> -<script type="text/javascript"> -var _paq = _paq || []; -_paq.push(["disableCookies"]); -_paq.push(['trackPageView']); -_paq.push(['enableLinkTracking']); -(function() { - var u="//stats.luxagraf.net/"; - _paq.push(['setTrackerUrl', u+'piwik.php']); - _paq.push(['setSiteId', 1]); - var d=document, g=d.createElement('script'), s=d.getElementsByTagName('script')[0]; - g.type='text/javascript'; g.async=true; g.defer=true; g.src=u+'piwik.js'; s.parentNode.insertBefore(g,s); -})(); +{% if debug %}{%else%} +<script> +if(/libregraf\.net/.test(window.location.hostname)){ + (function(f, a, t, h, o, m){ + a[h]=a[h]||function(){ + (a[h].q=a[h].q||[]).push(arguments) + }; + o=f.createElement('script'), + m=f.getElementsByTagName('script')[0]; + o.async=1; o.src=t; o.id='fathom-script'; + m.parentNode.insertBefore(o,m) + })(document, window, '//stats.luxagraf.net/tracker.js', 'fathom'); + fathom('set', 'siteId', 'HHQXL'); + fathom('trackPageview'); +} </script> -<noscript><p><img src="//stats.luxagraf.net/piwik.php?idsite=1" style="border:0;" alt="" /></p></noscript> -<!-- End Piwik Code --> -{%endcomment%} - +{% endif %} </body> </html> |