Added Piwik analytics
This commit is contained in:
parent
d397b32328
commit
f9c62cfc53
3 changed files with 33 additions and 1 deletions
|
@ -25,7 +25,7 @@ Have questions? Come talk to us on IRC in **#coleslaw** on Freenode!
|
|||
* Static Pages
|
||||
* Sitemap generation
|
||||
* Incremental builds
|
||||
* Analytics via Google
|
||||
* Analytics via Google or [Piwik](http://www.piwik.org)
|
||||
* Comments via [Disqus](http://disqus.com/) or [isso](http://posativ.org/isso)
|
||||
* Hosting via [Github Pages](https://pages.github.com/) or [Amazon S3](http://aws.amazon.com/s3/)
|
||||
* Embedding [gfycats](http://gfycat.com/)
|
||||
|
|
|
@ -14,6 +14,13 @@
|
|||
|
||||
**Example**: `(analytics :tracking-code "google-provided-unique-id")`
|
||||
|
||||
## Analytics via Piwik
|
||||
|
||||
**Description**: Provides traffic analysis through
|
||||
[Piwik](https://www.piwik.org).
|
||||
|
||||
**Example**: `(piwik :piwik-url "piwik.example.com")`
|
||||
|
||||
## CL-WHO
|
||||
|
||||
**Description**: Allows the user to write posts cl-who markup. Just create a
|
||||
|
|
25
plugins/piwik.lisp
Normal file
25
plugins/piwik.lisp
Normal file
|
@ -0,0 +1,25 @@
|
|||
(defpackage :coleslaw-piwik
|
||||
(:use :cl)
|
||||
(:export #:enable)
|
||||
(:import-from :coleslaw #:add-injection))
|
||||
|
||||
(in-package :coleslaw-piwik)
|
||||
|
||||
(defvar *piwik-js*
|
||||
"<script type="text/javascript">
|
||||
var _paq = _paq || [];
|
||||
_paq.push(['trackPageView']);
|
||||
_paq.push(['enableLinkTracking']);
|
||||
|
||||
(function() {
|
||||
var u="//~a/";
|
||||
_paq.push(['setTrackerUrl', u+'piwik.php']);
|
||||
_paq.push(['setSiteId', {$IDSITE}]);
|
||||
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);
|
||||
})();
|
||||
</script>")
|
||||
|
||||
(defun enable (&key piwik-url)
|
||||
(let ((snippet (format nil *piwik-js* piwik-url)))
|
||||
(add-injection (constantly snippet) :head)))
|
Loading…
Add table
Reference in a new issue