diff options
author | Ben Burgess <88810029+bx80@users.noreply.github.com> | 2021-10-04 07:01:04 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-10-04 07:01:04 +0300 |
commit | 2404b24c3a52f04475b63f300269a129399882ec (patch) | |
tree | 421e1a81c7f554561bec2cf8385d44ad478ed97f /tests/javascript/index.php | |
parent | deff627a8e9a4c476ba59cfe57c3797f65679c4f (diff) |
JavaScript tracker exclude query parameters (#18031)
Adds a new option to the JavaScript tracker to exclude query parameters from the tracked URL.
Co-authored-by: bx80 <bx80@users.noreply.github.com>
Co-authored-by: sgiehl <stefan@matomo.org>
Diffstat (limited to 'tests/javascript/index.php')
-rw-r--r-- | tests/javascript/index.php | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/tests/javascript/index.php b/tests/javascript/index.php index 8f66b3198f..38c023f336 100644 --- a/tests/javascript/index.php +++ b/tests/javascript/index.php @@ -2096,7 +2096,7 @@ function PiwikTest() { }); test("API methods", function() { - expect(120); + expect(121); equal( typeof Piwik.addPlugin, 'function', 'addPlugin' ); equal( typeof Piwik.addPlugin, 'function', 'addTracker' ); @@ -2164,6 +2164,7 @@ function PiwikTest() { equal( typeof tracker.disablePerformanceTracking, 'function', 'disablePerformanceTracking' ); equal( typeof tracker.setCampaignKeywordKey, 'function', 'setCampaignKeywordKey' ); equal( typeof tracker.discardHashTag, 'function', 'discardHashTag' ); + equal( typeof tracker.setExcludedQueryParams, 'function', 'setExcludedQueryParams' ); equal( typeof tracker.setCookieNamePrefix, 'function', 'setCookieNamePrefix' ); equal( typeof tracker.setCookieDomain, 'function', 'setCookieDomain' ); equal( typeof tracker.setCookiePath, 'function', 'setCookiePath' ); @@ -2392,7 +2393,7 @@ function PiwikTest() { }); test("Tracker getHostName(), *UrlParameter(), urlFixup(), domainFixup(), titleFixup() and purify()", function() { - expect(81); + expect(85); var tracker = Piwik.getTracker(); @@ -2508,6 +2509,14 @@ function PiwikTest() { equal( tracker.hook.test._purify('http://example.com'), 'http://example.com', 'http://example.com'); equal( tracker.hook.test._purify('http://example.com#hash'), 'http://example.com', 'http://example.com#hash'); equal( tracker.hook.test._purify('http://example.com/?q=xyz#hash'), 'http://example.com/?q=xyz', 'http://example.com/?q=xyz#hash'); + + tracker.setExcludedQueryParams(['sid', 'test']); + + equal( tracker.hook.test._purify('http://example.com/?sid=12345&test5=1'), 'http://example.com/?test5=1', 'http://example.com/?sid=12345&test5=1'); + equal( tracker.hook.test._purify('http://example.com/?asid=12345&test=1'), 'http://example.com/?asid=12345', 'http://example.com/?asid=12345&test=1'); + equal( tracker.hook.test._purify('http://example.com/?sid=test#hash'), 'http://example.com/', 'http://example.com/?sid=test#hash'); + equal( tracker.hook.test._purify('http://example.com/?sid=test&sidtest=xyz#test'), 'http://example.com/?sidtest=xyz', 'http://example.com/?sid=test&sidtest=xyz#test'); + }); // support for setCustomUrl( relativeURI ) |