Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/matomo-org/matomo.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--composer.lock8
-rw-r--r--plugins/CustomDimensions/angularjs/manage/edit.directive.html2
-rw-r--r--plugins/CustomDimensions/docs/faq.md2
-rw-r--r--plugins/CustomDimensions/tests/Fixtures/TrackVisitsWithCustomDimensionsFixture.php42
-rw-r--r--plugins/Live/tests/Fixtures/VisitsWithAllActionsAndDevices.php8
-rw-r--r--tests/LocalTracker.php7
-rw-r--r--tests/PHPUnit/Fixtures/ManySitesImportedLogsWithXssAttempts.php2
-rw-r--r--tests/PHPUnit/Fixtures/ManyVisitsWithMockLocationProvider.php2
-rw-r--r--tests/PHPUnit/System/TrackerResponseTest.php5
9 files changed, 44 insertions, 34 deletions
diff --git a/composer.lock b/composer.lock
index a3ae0b855e..08d3e74ac6 100644
--- a/composer.lock
+++ b/composer.lock
@@ -548,12 +548,12 @@
"source": {
"type": "git",
"url": "https://github.com/matomo-org/matomo-php-tracker.git",
- "reference": "3d2faa5ce463e70e38d344c9d18c34cec58fc5a6"
+ "reference": "e4c6829b2f330f088055aa8341e5f205d1ec1cc7"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/matomo-org/matomo-php-tracker/zipball/3d2faa5ce463e70e38d344c9d18c34cec58fc5a6",
- "reference": "3d2faa5ce463e70e38d344c9d18c34cec58fc5a6",
+ "url": "https://api.github.com/repos/matomo-org/matomo-php-tracker/zipball/e4c6829b2f330f088055aa8341e5f205d1ec1cc7",
+ "reference": "e4c6829b2f330f088055aa8341e5f205d1ec1cc7",
"shasum": ""
},
"require": {
@@ -588,7 +588,7 @@
"piwik",
"tracker"
],
- "time": "2020-06-09T08:59:01+00:00"
+ "time": "2020-07-27T20:23:33+00:00"
},
{
"name": "matomo/network",
diff --git a/plugins/CustomDimensions/angularjs/manage/edit.directive.html b/plugins/CustomDimensions/angularjs/manage/edit.directive.html
index aeb26b60ff..10719bd798 100644
--- a/plugins/CustomDimensions/angularjs/manage/edit.directive.html
+++ b/plugins/CustomDimensions/angularjs/manage/edit.directive.html
@@ -90,7 +90,7 @@
<p>
{{ 'CustomDimensions_HowToTrackManuallyViaPhp'|translate }}
</p>
- <pre piwik-select-on-focus><code>$tracker->setCustomTrackingParameter('dimension{{ editDimension.dimension.idcustomdimension }}', '{{ 'CustomDimensions_ExampleValue'|translate }}');</code></pre>
+ <pre piwik-select-on-focus><code>$tracker->setCustomDimension('{{ editDimension.dimension.idcustomdimension }}', '{{ 'CustomDimensions_ExampleValue'|translate }}');</code></pre>
<p>
{{ 'CustomDimensions_HowToTrackManuallyViaHttp'|translate }}
</p>
diff --git a/plugins/CustomDimensions/docs/faq.md b/plugins/CustomDimensions/docs/faq.md
index 81637ddc72..b5dc6ae59a 100644
--- a/plugins/CustomDimensions/docs/faq.md
+++ b/plugins/CustomDimensions/docs/faq.md
@@ -26,7 +26,7 @@ Please have a look at the [JavaScript Tracker guide for Custom Dimensions](https
__How do I set a value for a dimension in the PHP Tracker?__
-`$tracker->setCustomTrackingParameter('dimension' . $customDimensionId, $value);`
+`$tracker->setCustomDimension($customDimensionId, $value);`
Please note custom tracking parameters are cleared after each tracking request. If you want to keep the same
Custom Dimensions over all request make sure to call this method before each tracking call.
diff --git a/plugins/CustomDimensions/tests/Fixtures/TrackVisitsWithCustomDimensionsFixture.php b/plugins/CustomDimensions/tests/Fixtures/TrackVisitsWithCustomDimensionsFixture.php
index 8d56784160..936c259251 100644
--- a/plugins/CustomDimensions/tests/Fixtures/TrackVisitsWithCustomDimensionsFixture.php
+++ b/plugins/CustomDimensions/tests/Fixtures/TrackVisitsWithCustomDimensionsFixture.php
@@ -81,25 +81,25 @@ class TrackVisitsWithCustomDimensionsFixture extends Fixture
{
$t = self::getTracker($this->idSite, $this->dateTime, $defaultInit = true);
- $t->setCustomTrackingParameter('dimension1', 'value1');
- $t->setCustomTrackingParameter('dimension2', 'value2');
- $t->setCustomTrackingParameter('dimension3', 'value3');
- $t->setCustomTrackingParameter('dimension4', 'value4');
- $t->setCustomTrackingParameter('dimension5', 'value5');
- $t->setCustomTrackingParameter('dimension6', 'value6');
+ $t->setCustomDimension('1', 'value1');
+ $t->setCustomDimension('2', 'value2');
+ $t->setCustomDimension('3', 'value3');
+ $t->setCustomDimension('4', 'value4');
+ $t->setCustomDimension('5', 'value5');
+ $t->setCustomDimension('6', 'value6');
$t->setForceVisitDateTime(Date::factory($this->dateTime)->addHour(0.1)->getDatetime());
$t->setUrl('http://example.com/');
self::checkResponse($t->doTrackPageView('Viewing homepage'));
- $t->setCustomTrackingParameter('dimension1', 'value5 1');
- $t->setCustomTrackingParameter('dimension2', 'dim 2');
+ $t->setCustomDimension('1', 'value5 1');
+ $t->setCustomDimension('2', 'dim 2');
$t->setForceVisitDateTime(Date::factory($this->dateTime)->addHour(0.2)->getDatetime());
$t->setUrl('http://example.com/sub_en/page?test=343&param=23');
self::checkResponse($t->doTrackPageView('Second page view'));
- $t->setCustomTrackingParameter('dimension2', 'en_US');
- $t->setCustomTrackingParameter('dimension3', 'value5 3');
+ $t->setCustomDimension('2', 'en_US');
+ $t->setCustomDimension('3', 'value5 3');
$t->setForceVisitDateTime(Date::factory($this->dateTime)->addHour(0.3)->getDatetime());
$t->setUrl('http://example.com/sub_en/page?param=en_US');
self::checkResponse($t->doTrackPageView('Third page view'));
@@ -112,9 +112,9 @@ class TrackVisitsWithCustomDimensionsFixture extends Fixture
$t->setUrl('http://example.com/sub_en/page?param=en_US');
self::checkResponse($t->doTrackPageView('Fifth page view'));
- $t->setCustomTrackingParameter('dimension1', 'value1');
- $t->setCustomTrackingParameter('dimension2', 'value2');
- $t->setCustomTrackingParameter('dimension5', 'value5 5');
+ $t->setCustomDimension('1', 'value1');
+ $t->setCustomDimension('2', 'value2');
+ $t->setCustomDimension('5', 'value5 5');
$t->setForceVisitDateTime(Date::factory($this->dateTime)->addDay(3)->getDatetime());
$t->setUrl('http://example.com/sub_en/page?param=en_US');
self::checkResponse($t->doTrackPageView('Sixth page view'));
@@ -125,12 +125,12 @@ class TrackVisitsWithCustomDimensionsFixture extends Fixture
$t = self::getTracker($this->idSite2, $this->dateTime, $defaultInit = true);
$t->setIp('56.11.55.73');
- $t->setCustomTrackingParameter('dimension1', 'site2 value1');
- $t->setCustomTrackingParameter('dimension2', 'site2 value2');
- $t->setCustomTrackingParameter('dimension3', 'site2 value3');
- $t->setCustomTrackingParameter('dimension4', 'site2 value4');
- $t->setCustomTrackingParameter('dimension5', 'site2 value5');
- $t->setCustomTrackingParameter('dimension6', 'site2 value6');
+ $t->setCustomDimension('1', 'site2 value1');
+ $t->setCustomDimension('2', 'site2 value2');
+ $t->setCustomDimension('3', 'site2 value3');
+ $t->setCustomDimension('4', 'site2 value4');
+ $t->setCustomDimension('5', 'site2 value5');
+ $t->setCustomDimension('6', 'site2 value6');
$t->setForceVisitDateTime(Date::factory($this->dateTime)->addHour(0.1)->getDatetime());
$t->setUrl('http://example.com/sub_en/page');
@@ -151,8 +151,8 @@ class TrackVisitsWithCustomDimensionsFixture extends Fixture
$t = self::getTracker($this->idSite, $this->dateTime, $defaultInit = true);
$t->setIp('56.11.55.79');
- $t->setCustomTrackingParameter('dimension1', '');
- $t->setCustomTrackingParameter('dimension3', '');
+ $t->setCustomDimension('1', '');
+ $t->setCustomDimension('3', '');
$t->setForceVisitDateTime(Date::factory($this->dateTime)->addHour(0.1)->getDatetime());
$t->setUrl('http://example.com/sub_en/page');
diff --git a/plugins/Live/tests/Fixtures/VisitsWithAllActionsAndDevices.php b/plugins/Live/tests/Fixtures/VisitsWithAllActionsAndDevices.php
index f49fd37bcb..cf3ee64fb7 100644
--- a/plugins/Live/tests/Fixtures/VisitsWithAllActionsAndDevices.php
+++ b/plugins/Live/tests/Fixtures/VisitsWithAllActionsAndDevices.php
@@ -96,7 +96,7 @@ class VisitsWithAllActionsAndDevices extends Fixture
$t->setForceVisitDateTime(Date::factory($dateTime)->addHour(0.1)->getDatetime());
$t->setUrl('http://example.org/product42');
- $t->setCustomTrackingParameter('dimension2', 'NZD');
+ $t->setCustomDimension('2', 'NZD');
$t->setEcommerceView($sku = 'P42X4D', $name = 'product 42', $category = 'software', $price = 60);
$t->setPerformanceTimings(33, 222, 356, 444, 522, 211);
$t->setDebugStringAppend('bw_bytes=36053');
@@ -157,8 +157,8 @@ class VisitsWithAllActionsAndDevices extends Fixture
$t->setPerformanceTimings(55, 348, 256, 299, 165, 144);
$t->setDebugStringAppend('bw_bytes=6851');
$t->setCustomVariable(1, 'custom', 'variable', 'page');
- $t->setCustomTrackingParameter('dimension1', '42');
- $t->setCustomTrackingParameter('dimension2', '€');
+ $t->setCustomDimension('1', '42');
+ $t->setCustomDimension('2', '€');
self::checkResponse($t->doTrackPageView('product 42'));
$t->setForceVisitDateTime(Date::factory($dateTime)->addHour(0.09)->getDatetime());
@@ -194,7 +194,7 @@ class VisitsWithAllActionsAndDevices extends Fixture
$t->setUrlReferrer('http://www.nice.website/page3');
$t->setCustomVariable(1, 'promo', 'summer', 'visit');
- $t->setCustomTrackingParameter('dimension1', '16');
+ $t->setCustomDimension('1', '16');
$t->setUrl('http://example.org/');
$t->setPerformanceTimings(0, 255, 319, 395, 222, 92);
$t->setDebugStringAppend('bw_bytes=631');
diff --git a/tests/LocalTracker.php b/tests/LocalTracker.php
index 1510b15b74..f4a4bf5da2 100644
--- a/tests/LocalTracker.php
+++ b/tests/LocalTracker.php
@@ -20,6 +20,8 @@ class Matomo_LocalTracker extends MatomoTracker
{
protected function sendRequest($url, $method = 'GET', $data = null, $force = false)
{
+ self::$DEBUG_LAST_REQUESTED_URL = $url;
+
if ($this->DEBUG_APPEND_URL) {
$url .= $this->DEBUG_APPEND_URL;
}
@@ -39,6 +41,11 @@ class Matomo_LocalTracker extends MatomoTracker
$testEnvironmentArgs = array();
} else {
$testEnvironmentArgs = $this->parseUrl($url);
+
+ if (!empty($this->token_auth)) {
+ $testEnvironmentArgs['token_auth'] = $this->token_auth;
+ }
+
$requests = array($testEnvironmentArgs);
}
diff --git a/tests/PHPUnit/Fixtures/ManySitesImportedLogsWithXssAttempts.php b/tests/PHPUnit/Fixtures/ManySitesImportedLogsWithXssAttempts.php
index 27602998dd..78d691438e 100644
--- a/tests/PHPUnit/Fixtures/ManySitesImportedLogsWithXssAttempts.php
+++ b/tests/PHPUnit/Fixtures/ManySitesImportedLogsWithXssAttempts.php
@@ -175,7 +175,7 @@ class ManySitesImportedLogsWithXssAttempts extends ManySitesImportedLogs
$t = self::getTracker($this->idSite, $dateTime, $defaultInit= true);
$t->setUrl('http://example.org/' . urlencode($urlXss));
$t->setUrlReferrer($referrerUrlXss);
- $t->setCustomTrackingParameter('dimension1', $xssTesting->$type('customdimension'));
+ $t->setCustomDimension('1', $xssTesting->$type('customdimension'));
$t->setCustomVariable(1, $xssTesting->$type('customvarname'), $xssTesting->$type('customvarval'));
$t->setUserId($xssTesting->$type('userid'));
$t->setBrowserLanguage($xssTesting->$type('lang'));
diff --git a/tests/PHPUnit/Fixtures/ManyVisitsWithMockLocationProvider.php b/tests/PHPUnit/Fixtures/ManyVisitsWithMockLocationProvider.php
index 3a7a73d844..99a9dcf717 100644
--- a/tests/PHPUnit/Fixtures/ManyVisitsWithMockLocationProvider.php
+++ b/tests/PHPUnit/Fixtures/ManyVisitsWithMockLocationProvider.php
@@ -156,7 +156,7 @@ class ManyVisitsWithMockLocationProvider extends Fixture
$t->setUrl("http://piwik.net/$visitorCounter/");
$t->setUrlReferrer(null);
$t->setForceVisitDateTime($visitDate->getDatetime());
- $t->setCustomTrackingParameter('dimension' . $this->customDimensionId, $i * 5);
+ $t->setCustomDimension('' . $this->customDimensionId, $i * 5);
$this->trackAction($t, $actionType, $visitorCounter, null);
for ($j = 0; $j != 4; ++$j) {
diff --git a/tests/PHPUnit/System/TrackerResponseTest.php b/tests/PHPUnit/System/TrackerResponseTest.php
index f081ffcc16..74c9c05cdd 100644
--- a/tests/PHPUnit/System/TrackerResponseTest.php
+++ b/tests/PHPUnit/System/TrackerResponseTest.php
@@ -58,7 +58,7 @@ class TrackerResponseTest extends SystemTestCase
public function test_response_ShouldSend200ResponseCode_IfImageIsEnabled()
{
$url = $this->tracker->getUrlTrackPageView('Test');
-
+ $url .= '&token_auth=' . Fixture::getTokenAuth();
$response = $this->sendHttpRequest($url);
$this->assertEquals(200, $response['status']);
$this->assertArrayHasKey('Cache-Control', $response['headers']);
@@ -68,6 +68,7 @@ class TrackerResponseTest extends SystemTestCase
public function test_response_ShouldSend204ResponseCode_IfImageIsDisabled()
{
$url = $this->tracker->getUrlTrackPageView('Test');
+ $url .= '&token_auth=' . Fixture::getTokenAuth();
$url .= '&send_image=0';
$response = $this->sendHttpRequest($url);
@@ -115,6 +116,7 @@ class TrackerResponseTest extends SystemTestCase
public function test_response_ShouldSend400ResponseCode_IfInvalidRequestParameterIsGiven()
{
$url = $this->tracker->getUrlTrackPageView('Test');
+ $url .= '&token_auth=' . Fixture::getTokenAuth();
$url .= '&cid=' . str_pad('1', 16, '1');
$response = $this->sendHttpRequest($url);
@@ -152,6 +154,7 @@ class TrackerResponseTest extends SystemTestCase
public function test_response_ShouldReturnPiwikMessageWithHttp503_InCaseOfMaintenanceMode()
{
$url = $this->tracker->getUrlTrackPageView('Test');
+ $url .= '&token_auth=' . Fixture::getTokenAuth();
$response = $this->sendHttpRequest($url);
$this->assertEquals(200, $response['status']);