mirror of
https://github.com/shlinkio/shlink.git
synced 2024-11-24 05:38:06 +03:00
Pass visit date to matomo when tracking
This commit is contained in:
parent
ca42425b33
commit
4fdbcc25a0
2 changed files with 8 additions and 1 deletions
|
@ -23,7 +23,8 @@ readonly class MatomoVisitSender implements MatomoVisitSenderInterface
|
|||
->setUrl($this->resolveUrlToTrack($visit))
|
||||
->setCustomTrackingParameter('type', $visit->type->value)
|
||||
->setUserAgent($visit->userAgent)
|
||||
->setUrlReferrer($visit->referer);
|
||||
->setUrlReferrer($visit->referer)
|
||||
->setForceVisitDateTime($visit->date->setTimezone('UTC')->toDateTimeString());
|
||||
|
||||
$location = $visit->getVisitLocation();
|
||||
if ($location !== null) {
|
||||
|
|
|
@ -42,6 +42,9 @@ class MatomoVisitSenderTest extends TestCase
|
|||
$tracker->expects($this->once())->method('setUserAgent')->willReturn($tracker);
|
||||
$tracker->expects($this->once())->method('setUrlReferrer')->willReturn($tracker);
|
||||
$tracker->expects($this->once())->method('doTrackPageView')->with($visit->shortUrl?->title() ?? '');
|
||||
$tracker->expects($this->once())->method('setForceVisitDateTime')->with(
|
||||
$visit->date->setTimezone('UTC')->toDateTimeString(),
|
||||
);
|
||||
|
||||
if ($visit->isOrphan()) {
|
||||
$tracker->expects($this->exactly(2))->method('setCustomTrackingParameter')->willReturnMap([
|
||||
|
@ -93,6 +96,9 @@ class MatomoVisitSenderTest extends TestCase
|
|||
$tracker->expects($this->once())->method('setUrlReferrer')->willReturn($tracker);
|
||||
$tracker->expects($this->any())->method('setCustomTrackingParameter')->willReturn($tracker);
|
||||
$tracker->expects($this->once())->method('doTrackPageView');
|
||||
$tracker->expects($this->once())->method('setForceVisitDateTime')->with(
|
||||
$visit->date->setTimezone('UTC')->toDateTimeString(),
|
||||
);
|
||||
|
||||
$this->trackerBuilder->expects($this->once())->method('buildMatomoTracker')->willReturn($tracker);
|
||||
|
||||
|
|
Loading…
Reference in a new issue