Daniel Siepmann - Coding is Art

TYPO3 Extension: tracking

Purpose of project

I've made this tiny little project in order to have a basic tracking on my own website. I didn't want to include any 3rd party services like Google Analytics. I also didn't want to have any JavaScript involved. Instead the goal was to use all the new technical features within TYPO3.

Current state

Right now the extension tracks all page views. Those are saved in a new database table. All entries are available through TYPO3 list module and widgets for EXT:dashboard. Integrators can define a black list of incoming requests which should not be tracked, e.g. logged in backend users.

Therefore the following technical parts are used:

  • PSR-7 HTTP Message Interface
  • PSR-11 Container Interface
  • PSR-15 HTTP Handlers
  • TYPO3 Context API
  • Symfony Expression Language


Screenshot of TYPO3 dashbaord widgets, displaying pageview records.
Figure i20: Demonstrates how collected pageviews can be visualized via EXT:dashboard.
Screenshot of TYPO3 list view, displaying pageview records.
Figure i21: Demonstrates how collected pageviews are displayed in TYPO3 list module.

How does it work?

Right now the heart of the extension is a custom middleware DanielSiepmann\Tracking\Middleware\Pageview. That middleware will process incoming requests, check for black listing and add a new pageview entry.

More on middlewares inside of TYPO3 can be read at docs.typo3.org.

That middleware uses Symfony Expression Language to execute a configured rule to check for blacklisted requests. More on that topic can be found at symfony.com.

In order to keep code clean and small, dependency injection is used to resolve dependencies from middleware. The dependency injection is used to provide the rule to check for blacklisting. The rule is defined inside Symfony.yaml, and can be overwritten in custom extensions, e.g. a sitepackage. More about that topic is available at docs.typo3.org, symfony.com and usetypo3.com.

Also two widgets are registered for ext:dashboard. Registering dashboards also is done via Services.yaml. The widgets use again dependency injection, e.g. to inject foreign classes to collect data from database, but also to get configuration, e.g. pages to ignore (startpage) and period of time to display. The extension comes with defaults, which can be overwritten in custom extension. Maybe not the best way, but right now that's working.

Where to get it

The TYPO3 extension is published on GitHub.com. It will not be released to packagist.org or extensions.typo3.org. The extension is only developed for demonstration purposes.

I would recommend to either download as zip and install plain, or use composer. Therefore add the following to your composer.json:

"repositories": [
        "type": "vcs",
        "url": "https://github.com/DanielSiepmann/tracking.git"

and execute:

composer require "danielsiepmann/tracking:^1.0"