diff --git a/core/Tracker/Action.php b/core/Tracker/Action.php index ca11a5d5262cd3b31e29ad65904b503cad96466b..0b88aed213382bf291381d58ccc81e970edc1e7a 100644 --- a/core/Tracker/Action.php +++ b/core/Tracker/Action.php @@ -208,8 +208,9 @@ abstract class Action protected function setActionUrlWithoutExcludingParameters($url) { - $this->rawActionUrl = PageUrl::getUrlIfLookValid($url); - $this->actionUrl = PageUrl::getUrlIfLookValid($url); + $url = PageUrl::getUrlIfLookValid($url); + $this->rawActionUrl = $url; + $this->actionUrl = $url; } abstract protected function getActionsToLookup(); diff --git a/tests/PHPUnit/Integration/TrackerTest.php b/tests/PHPUnit/Integration/TrackerTest.php index 4daddc0d09aeda3d141c13e919594ddacff583fe..f440cf2e3f6286a121dcc6c3312c9e50301dd355 100644 --- a/tests/PHPUnit/Integration/TrackerTest.php +++ b/tests/PHPUnit/Integration/TrackerTest.php @@ -59,9 +59,6 @@ class TrackerTest extends IntegrationTestCase { parent::setUp(); - GlobalSettingsProvider::unsetSingletonInstance(); - Config::unsetInstance(); - Fixture::createWebsite('2014-01-01 00:00:00'); $this->tracker = new TestTracker(); @@ -253,6 +250,22 @@ class TrackerTest extends IntegrationTestCase $this->assertActionEquals('example.com', 2); } + public function test_trackRequest_shouldTrackOutlinkWithFragment() + { + $request = $this->buildRequest(array('idsite' => 1, 'link' => 'http://example.com/outlink#fragment-here', 'rec' => 1)); + $this->tracker->trackRequest($request); + + $this->assertActionEquals('http://example.com/outlink#fragment-here', 1); + } + + public function test_trackRequest_shouldTrackDownloadWithFragment() + { + $request = $this->buildRequest(array('idsite' => 1, 'download' => 'http://example.com/file.zip#fragment-here&pk_campaign=Campaign param accepted here', 'rec' => 1)); + $this->tracker->trackRequest($request); + + $this->assertActionEquals('http://example.com/file.zip#fragment-here&pk_campaign=Campaign param accepted here', 1); + } + public function test_main_shouldReturnEmptyPiwikResponse_IfNoRequestsAreGiven() { $requestSet = $this->getEmptyRequestSet();