Support integration of Piwik/Matomo in KorAP

Change-Id: I0c67971e67fe83b5c6d8d3dc584fed23c989728b
diff --git a/Changes b/Changes
index f1c0ddc..dad131a 100755
--- a/Changes
+++ b/Changes
@@ -17,6 +17,7 @@
         - Removed "contains" and "containsnot" from
           string type.
         - Added "ne" operation to date meta type.
+        - Added Piwik/Matomo integration.
 
 0.25 2018-01-31
         - Make annotation helper configurable.
diff --git a/Makefile.PL b/Makefile.PL
index 03fd375..f85a1bd 100644
--- a/Makefile.PL
+++ b/Makefile.PL
@@ -26,6 +26,7 @@
     'Mojolicious::Plugin::MailException' => 0.20,
     'Mojolicious::Plugin::CHI' => 0.15,
     'Mojolicious::Plugin::ClientIP' => 0.01,
+    'Mojolicious::Plugin::Piwik' => 0.20,
     'Cache::FastMmap' => 0,
     'Mojo::JWT' => 0.05,
 
diff --git a/kalamar.conf b/kalamar.conf
index 5a7c635..e6d8e05 100644
--- a/kalamar.conf
+++ b/kalamar.conf
@@ -50,6 +50,11 @@
     pattern_rotate => 673
   },
 
+  # See Mojolicious::Plugin::Piwik
+  Piwik => {
+    embed => 'false'
+  },
+
   # See Mojolicious::Plugin::CHI
   CHI => {
     default => {
diff --git a/lib/Kalamar.pm b/lib/Kalamar.pm
index 7eec66c..572f006 100644
--- a/lib/Kalamar.pm
+++ b/lib/Kalamar.pm
@@ -129,7 +129,8 @@
     'KalamarHelpers',            # Specific Helpers for Kalamar
     'KalamarUser',               # Specific Helpers for Kalamar
     'ClientIP',                  # Get client IP from X-Forwarded-For
-    'ClosedRedirect'             # Redirect with OpenRedirect protection
+    'ClosedRedirect',            # Redirect with OpenRedirect protection
+    'Piwik'                      # Integrate Piwik/Matomo Analytics
   ) {
     $self->plugin($_);
   };
diff --git a/templates/layouts/main.html.ep b/templates/layouts/main.html.ep
index 9d9640b..966803c 100644
--- a/templates/layouts/main.html.ep
+++ b/templates/layouts/main.html.ep
@@ -78,5 +78,6 @@
     </footer>
     % };
     %= notifications 'Kalamar::Plugin::Notifications'
+    %= piwik_tag
   </body>
 </html>