tracking/Configuration/Services.yaml
Daniel Siepmann 33685d1735 Add tracking of record views
Allow Integrator to define rules to track views of records.
This allows to add tracking to extensions like tx_news.
Integrators are able to define matching rules on current request. If a
request matches, the record is stored as individual view beside existing
pageview.

Relates: #14
2020-07-30 13:52:33 +02:00

74 lines
2.4 KiB
YAML

imports:
- { resource: Backend/DashboardWidgets.yaml }
services:
_defaults:
autowire: true
autoconfigure: true
public: false
DanielSiepmann\Tracking\:
resource: '../Classes/*'
exclude: '../Classes/Dashboard/*'
dbconnection.tx_tracking_pageview:
class: 'TYPO3\CMS\Core\Database\Connection'
factory:
- '@TYPO3\CMS\Core\Database\ConnectionPool'
- 'getConnectionForTable'
arguments:
- 'tx_tracking_pageview'
querybuilder.tx_tracking_pageview:
class: 'TYPO3\CMS\Core\Database\Query\QueryBuilder'
factory:
- '@TYPO3\CMS\Core\Database\ConnectionPool'
- 'getQueryBuilderForTable'
arguments:
- 'tx_tracking_pageview'
dbconnection.tx_tracking_recordview:
class: 'TYPO3\CMS\Core\Database\Connection'
factory:
- '@TYPO3\CMS\Core\Database\ConnectionPool'
- 'getConnectionForTable'
arguments:
- 'tx_tracking_recordview'
querybuilder.tx_tracking_recordview:
class: 'TYPO3\CMS\Core\Database\Query\QueryBuilder'
factory:
- '@TYPO3\CMS\Core\Database\ConnectionPool'
- 'getQueryBuilderForTable'
arguments:
- 'tx_tracking_recordview'
DanielSiepmann\Tracking\Domain\Repository\Pageview:
public: true
arguments:
- '@dbconnection.tx_tracking_pageview'
DanielSiepmann\Tracking\Domain\Repository\Recordview:
public: true
arguments:
- '@dbconnection.tx_tracking_recordview'
DanielSiepmann\Tracking\Middleware\Pageview:
public: true
arguments:
$rule: >
not (context.getAspect("backend.user").isLoggedIn())
and not (request.getHeader("User-Agent")[0] matches "/^TYPO3|TYPO3 linkvalidator/")
and not (request.getHeader("User-Agent")[0] matches "/Wget|curl|Go-http-client/")
and not (request.getHeader("User-Agent")[0] matches "/Googlebot|Bingbot|bingbot|Slurp|DuckDuckBot|Baiduspider|YandexBot|Sogou|Exabot|NextCloud-News|Feedly|XING FeedReader|CCBot|SemrushBot|SEOkicks|Twitterbot|Seekport Crawler|SemanticScholarBot|ia_archiver|PaperLiBot|TrendsmapResolver|AhrefsBot|Nuzzel/")
and not (request.getHeader("User-Agent")[0] matches "/mattermost|Slackbot|WhatsApp/")
DanielSiepmann\Tracking\Middleware\Recordview:
public: true
arguments:
$rules: []
DanielSiepmann\Tracking\Command\UpdateDataCommand:
tags:
- name: 'console.command'
command: 'tracking:updatedata'