diff --git a/CHANGELOG.rst b/CHANGELOG.rst
index d104fae..1f990c9 100644
--- a/CHANGELOG.rst
+++ b/CHANGELOG.rst
@@ -1,3 +1,7 @@
+Unreleased
+----------
+* Remove deprecated Piwik integration. Use Matomo instead! (Peter Bittner)
+
Version 3.1.0
-------------
* Rename default branch from master to main (Peter Bittner, Jannis Leidel)
diff --git a/analytical/templatetags/analytical.py b/analytical/templatetags/analytical.py
index a7c364b..ee6aa42 100644
--- a/analytical/templatetags/analytical.py
+++ b/analytical/templatetags/analytical.py
@@ -35,7 +35,6 @@ TAG_MODULES = [
'analytical.olark',
'analytical.optimizely',
'analytical.performable',
- 'analytical.piwik',
'analytical.rating_mailru',
'analytical.snapengage',
'analytical.spring_metrics',
diff --git a/analytical/templatetags/piwik.py b/analytical/templatetags/piwik.py
deleted file mode 100644
index 88adb9c..0000000
--- a/analytical/templatetags/piwik.py
+++ /dev/null
@@ -1,121 +0,0 @@
-"""
-Piwik template tags and filters.
-"""
-
-import re
-import warnings
-from collections import namedtuple
-from itertools import chain
-
-from django.conf import settings
-from django.template import Library, Node, TemplateSyntaxError
-
-from analytical.utils import (
- disable_html,
- get_identity,
- get_required_setting,
- is_internal_ip,
-)
-
-# domain name (characters separated by a dot), optional port, optional URI path, no slash
-DOMAINPATH_RE = re.compile(r'^(([^./?#@:]+\.)*[^./?#@:]+)+(:[0-9]+)?(/[^/?#@:]+)*$')
-
-# numeric ID
-SITEID_RE = re.compile(r'^\d+$')
-
-TRACKING_CODE = """
-
-
-""" # noqa
-
-VARIABLE_CODE = '_paq.push(["setCustomVariable", %(index)s, "%(name)s", "%(value)s", "%(scope)s"]);' # noqa
-IDENTITY_CODE = '_paq.push(["setUserId", "%(userid)s"]);'
-DISABLE_COOKIES_CODE = '_paq.push([\'disableCookies\']);'
-
-DEFAULT_SCOPE = 'page'
-
-PiwikVar = namedtuple('PiwikVar', ('index', 'name', 'value', 'scope'))
-
-
-register = Library()
-
-
-@register.tag
-def piwik(parser, token):
- """
- Piwik tracking template tag.
-
- Renders Javascript code to track page visits. You must supply
- your Piwik domain (plus optional URI path), and tracked site ID
- in the ``PIWIK_DOMAIN_PATH`` and the ``PIWIK_SITE_ID`` setting.
-
- Custom variables can be passed in the ``piwik_vars`` context
- variable. It is an iterable of custom variables as tuples like:
- ``(index, name, value[, scope])`` where scope may be ``'page'``
- (default) or ``'visit'``. Index should be an integer and the
- other parameters should be strings.
- """
- warnings.warn('The Piwik module is deprecated; use the Matomo module.', DeprecationWarning)
- bits = token.split_contents()
- if len(bits) > 1:
- raise TemplateSyntaxError("'%s' takes no arguments" % bits[0])
- return PiwikNode()
-
-
-class PiwikNode(Node):
- def __init__(self):
- self.domain_path = \
- get_required_setting('PIWIK_DOMAIN_PATH', DOMAINPATH_RE,
- "must be a domain name, optionally followed "
- "by an URI path, no trailing slash (e.g. "
- "piwik.example.com or my.piwik.server/path)")
- self.site_id = \
- get_required_setting('PIWIK_SITE_ID', SITEID_RE,
- "must be a (string containing a) number")
-
- def render(self, context):
- custom_variables = context.get('piwik_vars', ())
-
- complete_variables = (var if len(var) >= 4 else var + (DEFAULT_SCOPE,)
- for var in custom_variables)
-
- variables_code = (VARIABLE_CODE % PiwikVar(*var)._asdict()
- for var in complete_variables)
-
- commands = []
- if getattr(settings, 'PIWIK_DISABLE_COOKIES', False):
- commands.append(DISABLE_COOKIES_CODE)
-
- userid = get_identity(context, 'piwik')
- if userid is not None:
- variables_code = chain(variables_code, (
- IDENTITY_CODE % {'userid': userid},
- ))
-
- html = TRACKING_CODE % {
- 'url': self.domain_path,
- 'siteid': self.site_id,
- 'variables': '\n '.join(variables_code),
- 'commands': '\n '.join(commands)
- }
- if is_internal_ip(context, 'PIWIK'):
- html = disable_html(html, 'Piwik')
- return html
-
-
-def contribute_to_analytical(add_node):
- PiwikNode() # ensure properly configured
- add_node('body_bottom', PiwikNode)
diff --git a/docs/install.rst b/docs/install.rst
index ba82fbb..927e238 100644
--- a/docs/install.rst
+++ b/docs/install.rst
@@ -188,11 +188,6 @@ settings required to enable each service are listed here:
PERFORMABLE_API_KEY = '123abc'
-* :doc:`Piwik (deprecated, see Matomo) `::
-
- PIWIK_DOMAIN_PATH = 'your.piwik.server/optional/path'
- PIWIK_SITE_ID = '123'
-
* :doc:`Rating\@Mail.ru `::
RATING_MAILRU_COUNTER_ID = '1234567'
diff --git a/docs/services/piwik.rst b/docs/services/piwik.rst
deleted file mode 100644
index 30f6d9a..0000000
--- a/docs/services/piwik.rst
+++ /dev/null
@@ -1,179 +0,0 @@
-==================================
-Piwik (deprecated) -- open source web analytics
-==================================
-
-Piwik_ is an open analytics platform currently used by individuals,
-companies and governments all over the world. With Piwik, your data
-will always be yours, because you run your own analytics server.
-
-.. _Piwik: http://www.piwik.org/
-
-
-Deprecated
-==========
-
-Note that Piwik is now known as Matomo. New projects should use the
-Matomo integration. The Piwik integration in django-analytical is
-deprecated and eventually will be removed.
-
-
-Installation
-============
-
-To start using the Piwik integration, you must have installed the
-django-analytical package and have added the ``analytical`` application
-to :const:`INSTALLED_APPS` in your project :file:`settings.py` file.
-See :doc:`../install` for details.
-
-Next you need to add the Piwik template tag to your templates. This
-step is only needed if you are not using the generic
-:ttag:`analytical.*` tags. If you are, skip to
-:ref:`piwik-configuration`.
-
-The Piwik tracking code is inserted into templates using a template
-tag. Load the :mod:`piwik` template tag library and insert the
-:ttag:`piwik` tag. Because every page that you want to track must
-have the tag, it is useful to add it to your base template. Insert
-the tag at the bottom of the HTML body as recommended by the
-`Piwik best practice for Integration Plugins`_::
-
- {% load piwik %}
- ...
- {% piwik %}
-