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:
authorAltamash Shaikh <altu9594@gmail.com>2022-08-25 11:00:15 +0300
committerGitHub <noreply@github.com>2022-08-25 11:00:15 +0300
commit2f4788da48a05afa511a2064b6a7374b0d8205d5 (patch)
treea3885e9acbcfac85fd901a593b64580a2b4f0e5d
parent006a45342122c95034ad8efbe074b15ae83f468f (diff)
Added code to exclude Microsoft and Yandex click from query parameters,#DEV-2774 (#19673)
-rw-r--r--config/global.ini.php2
-rw-r--r--tests/PHPUnit/Integration/Tracker/ActionTest.php31
2 files changed, 32 insertions, 1 deletions
diff --git a/config/global.ini.php b/config/global.ini.php
index 5b73f6c2f1..c2f969582a 100644
--- a/config/global.ini.php
+++ b/config/global.ini.php
@@ -938,7 +938,7 @@ default_time_one_page_visit = 0
; Comma separated list of URL query string variable names that will be removed from your tracked URLs
; By default, Matomo will remove the most common parameters which are known to change often (eg. session ID parameters)
-url_query_parameter_to_exclude_from_url = "gclid,fbclid,fb_xd_fragment,fb_comment_id,phpsessid,jsessionid,sessionid,aspsessionid,doing_wp_cron,sid,pk_vid"
+url_query_parameter_to_exclude_from_url = "gclid,fbclid,msclkid,yclid,fb_xd_fragment,fb_comment_id,phpsessid,jsessionid,sessionid,aspsessionid,doing_wp_cron,sid,pk_vid"
; If set to 1, Matomo will use the default provider if no other provider is configured.
; In addition the default provider will be used as a fallback when the configure provider does not return any results.
diff --git a/tests/PHPUnit/Integration/Tracker/ActionTest.php b/tests/PHPUnit/Integration/Tracker/ActionTest.php
index afb43e806e..5031d91597 100644
--- a/tests/PHPUnit/Integration/Tracker/ActionTest.php
+++ b/tests/PHPUnit/Integration/Tracker/ActionTest.php
@@ -170,6 +170,37 @@ class ActionTest extends IntegrationTestCase
$this->assertEquals($filteredUrl[0], PageUrl::excludeQueryParametersFromUrl($url, $idSite));
}
+ public function getTestAdvertisingClickIdUrls()
+ {
+ return [
+ ['https://www.example.com?gclid=1234', 'https://www.example.com'],
+ ['https://www.example.com?fbclid=1234', 'https://www.example.com'],
+ ['https://www.example.com?msclkid=1234', 'https://www.example.com'],
+ ['https://www.example.com?yclid=1234', 'https://www.example.com'],
+ ['https://www.example.com/path1?gclid=1234', 'https://www.example.com/path1'],
+ ['https://www.example.com/path2?fbclid=1234', 'https://www.example.com/path2'],
+ ['https://www.example.com/path3?msclkid=1234', 'https://www.example.com/path3'],
+ ['https://www.example.com/path4?yclid=1234', 'https://www.example.com/path4'],
+ ['https://www.example.com?random=1234', 'https://www.example.com?random=1234'],
+ ['https://www.example.com?random=1234&yclid=qwerty', 'https://www.example.com?random=1234'],
+ ];
+ }
+
+ /**
+ * No excluded query parameters specified, apart from the standard "session" parameters, always excluded
+ *
+ * @dataProvider getTestAdvertisingClickIdUrls
+ */
+ public function testExcludeQueryParametersAdvertisingClickIds($url, $filteredUrl)
+ {
+ $this->setUpRootAccess();
+ $idSite = API::getInstance()->addSite("site1", array('http://example.org'), $ecommerce = 0,
+ $siteSearch = 1, $searchKeywordParameters = null, $searchCategoryParameters = null,
+ $excludedIps = '', $excludedQueryParameters = '', $timezone = null, $currency = null,
+ $group = null, $startDate = null, $excludedUserAgents = null, $keepURLFragments = 1);
+ $this->assertEquals($filteredUrl, PageUrl::excludeQueryParametersFromUrl($url, $idSite));
+ }
+
public function getTestUrlsHashtag()
{
$urls = array(