From 2ea338c675b7fe28609ebac1f2b62491e146580d Mon Sep 17 00:00:00 2001 From: Daniel Siepmann Date: Wed, 29 Jul 2020 10:15:50 +0200 Subject: [PATCH] Add new tracking of record views Split tracking configuration in extra file --- Configuration/Services.yaml | 29 ++--------------- Configuration/Services/Tracking.yaml | 47 ++++++++++++++++++++++++++++ 2 files changed, 50 insertions(+), 26 deletions(-) create mode 100644 Configuration/Services/Tracking.yaml diff --git a/Configuration/Services.yaml b/Configuration/Services.yaml index ea2055a..87d99d8 100644 --- a/Configuration/Services.yaml +++ b/Configuration/Services.yaml @@ -1,3 +1,6 @@ +imports: + - {resource: Services/Tracking.yaml} + services: _defaults: autowire: true @@ -25,29 +28,3 @@ services: iconIdentifier: 'content-widget-rss' height: 'medium' width: 'small' - - DanielSiepmann\Tracking\Dashboard\Provider\PageviewsPerDay: - arguments: - $queryBuilder: '@querybuilder.tx_tracking_pageview' - $blackListedPages: [1, 11, 38] - - DanielSiepmann\Tracking\Dashboard\Provider\PageviewsPerPage: - arguments: - $queryBuilder: '@querybuilder.tx_tracking_pageview' - $blackListedPages: [1, 11, 38] - - DanielSiepmann\Tracking\Dashboard\Provider\NewestPageviews: - arguments: - $queryBuilder: '@querybuilder.tx_tracking_pageview' - $blackListedPages: [1, 11, 38] - - 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 "/^Codeception Testing/") - 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/") diff --git a/Configuration/Services/Tracking.yaml b/Configuration/Services/Tracking.yaml new file mode 100644 index 0000000..7f1b65d --- /dev/null +++ b/Configuration/Services/Tracking.yaml @@ -0,0 +1,47 @@ +services: + _defaults: + autowire: true + autoconfigure: true + public: false + + DanielSiepmann\Tracking\Dashboard\Provider\PageviewsPerDay: + arguments: + $queryBuilder: '@querybuilder.tx_tracking_pageview' + $blackListedPages: [1, 11, 38] + + DanielSiepmann\Tracking\Dashboard\Provider\PageviewsPerPage: + arguments: + $queryBuilder: '@querybuilder.tx_tracking_pageview' + $blackListedPages: [1, 11, 38] + + DanielSiepmann\Tracking\Dashboard\Provider\NewestPageviews: + arguments: + $queryBuilder: '@querybuilder.tx_tracking_pageview' + $blackListedPages: [1, 11, 38] + + 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 "/^Codeception Testing/") + and not (request.getHeader("User-Agent")[0] matches "/Wget|curl|Go-http-client/") + and not (request.getHeader("User-Agent")[0] matches "/bot|spider|Slurp|Sogou|NextCloud-News|Feedly|XING FeedReader|SEOkicks|Seekport Crawler|ia_archiver|TrendsmapResolver|Nuzzel/") + and not (request.getHeader("User-Agent")[0] matches "/mattermost|Slackbot|WhatsApp/") + + DanielSiepmann\Tracking\Middleware\Recordview: + public: true + arguments: + $rules: + topics: + matches: > + request.getQueryParams()["topic_id"] > 0 + and 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 "/^Codeception Testing/") + and not (request.getHeader("User-Agent")[0] matches "/Wget|curl|Go-http-client/") + and not (request.getHeader("User-Agent")[0] matches "/bot|spider|Slurp|Sogou|NextCloud-News|Feedly|XING FeedReader|SEOkicks|Seekport Crawler|ia_archiver|TrendsmapResolver|Nuzzel/") + and not (request.getHeader("User-Agent")[0] matches "/mattermost|Slackbot|WhatsApp/") + recordUid: 'request.getQueryParams()["topic_id"]' + tableName: 'sys_category'