diff --git a/Classes/Domain/Model/Pageview.php b/Classes/Domain/Model/Pageview.php
index 6f39b83..83404d4 100644
--- a/Classes/Domain/Model/Pageview.php
+++ b/Classes/Domain/Model/Pageview.php
@@ -50,18 +50,25 @@ class Pageview
*/
private $url;
+ /**
+ * @var string
+ */
+ private $userAgent;
+
public function __construct(
int $pageUid,
SiteLanguage $language,
\DateTimeImmutable $crdate,
int $pageType,
- string $url
+ string $url,
+ string $userAgent
) {
$this->pageUid = $pageUid;
$this->language = $language;
$this->crdate = $crdate;
$this->pageType = $pageType;
$this->url = $url;
+ $this->userAgent = $userAgent;
}
public function getPageUid(): int
@@ -88,4 +95,9 @@ class Pageview
{
return $this->url;
}
+
+ public function getUserAgent(): string
+ {
+ return $this->userAgent;
+ }
}
diff --git a/Classes/Domain/Pageview/Factory.php b/Classes/Domain/Pageview/Factory.php
index cd5faea..f6a1ef3 100644
--- a/Classes/Domain/Pageview/Factory.php
+++ b/Classes/Domain/Pageview/Factory.php
@@ -35,7 +35,8 @@ class Factory implements FromRequest
$request->getAttribute('language'),
new \DateTimeImmutable(),
static::getRouting($request)->getPageType(),
- (string) $request->getUri()
+ (string) $request->getUri(),
+ $request->getHeader('User-Agent')[0] ?? ''
);
}
diff --git a/Classes/Domain/Repository/Pageview.php b/Classes/Domain/Repository/Pageview.php
index b6b7793..069d2ff 100644
--- a/Classes/Domain/Repository/Pageview.php
+++ b/Classes/Domain/Repository/Pageview.php
@@ -47,6 +47,7 @@ class Pageview
'type' => $pageview->getPageType(),
'sys_language_uid' => $pageview->getLanguage()->getLanguageId(),
'url' => $pageview->getUrl(),
+ 'user_agent' => $pageview->getUserAgent(),
]
);
}
diff --git a/Configuration/TCA/tx_tracking_pageview.php b/Configuration/TCA/tx_tracking_pageview.php
index 686b416..5ecc63b 100644
--- a/Configuration/TCA/tx_tracking_pageview.php
+++ b/Configuration/TCA/tx_tracking_pageview.php
@@ -14,11 +14,11 @@ return [
],
'interface' => [
'always_description' => 0,
- 'showRecordFieldList' => 'url, type, sys_language_uid, crdate, tstamp, crdate, cruser_id'
+ 'showRecordFieldList' => 'url, user_agent, type, sys_language_uid, crdate, tstamp, crdate, cruser_id'
],
'types' => [
'0' => [
- 'showitem' => 'sys_language_uid, pid, url, type, crdate',
+ 'showitem' => 'sys_language_uid, pid, url, user_agent, type, crdate',
],
],
'columns' => [
@@ -50,6 +50,13 @@ return [
'readOnly' => true,
]
],
+ 'user_agent' => [
+ 'label' => 'LLL:EXT:tracking/Resources/Private/Language/locallang_tca.xlf:table.pageview.user_agent',
+ 'config' => [
+ 'type' => 'input',
+ 'readOnly' => true,
+ ],
+ ],
'type' => [
'label' => 'LLL:EXT:tracking/Resources/Private/Language/locallang_tca.xlf:table.pageview.type',
'config' => [
diff --git a/Resources/Private/Language/locallang_tca.xlf b/Resources/Private/Language/locallang_tca.xlf
index 69269df..03f191e 100644
--- a/Resources/Private/Language/locallang_tca.xlf
+++ b/Resources/Private/Language/locallang_tca.xlf
@@ -24,6 +24,9 @@
+
+
+