From f9c62cfc53278a1c921626a62c34883e7835f7de Mon Sep 17 00:00:00 2001 From: Cthulhux Date: Mon, 31 Jul 2017 16:54:54 +0200 Subject: [PATCH] Added Piwik analytics --- README.md | 2 +- docs/plugin-use.md | 7 +++++++ plugins/piwik.lisp | 25 +++++++++++++++++++++++++ 3 files changed, 33 insertions(+), 1 deletion(-) create mode 100644 plugins/piwik.lisp diff --git a/README.md b/README.md index 7e56ddc..158a695 100644 --- a/README.md +++ b/README.md @@ -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/) diff --git a/docs/plugin-use.md b/docs/plugin-use.md index 3e3c2f9..a40f18e 100644 --- a/docs/plugin-use.md +++ b/docs/plugin-use.md @@ -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 diff --git a/plugins/piwik.lisp b/plugins/piwik.lisp new file mode 100644 index 0000000..a3e9e5c --- /dev/null +++ b/plugins/piwik.lisp @@ -0,0 +1,25 @@ +(defpackage :coleslaw-piwik + (:use :cl) + (:export #:enable) + (:import-from :coleslaw #:add-injection)) + +(in-package :coleslaw-piwik) + +(defvar *piwik-js* + "") + +(defun enable (&key piwik-url) + (let ((snippet (format nil *piwik-js* piwik-url))) + (add-injection (constantly snippet) :head)))