diff options
author | Stefan Giehl <stefan@matomo.org> | 2022-05-30 19:21:57 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-05-30 19:21:57 +0300 |
commit | bd6b69c57641222f0ade973087555f42e02acb6a (patch) | |
tree | d8fc08440946912c833df5a4fb69c0ac3d6c33d5 /tests | |
parent | 7fa84731896c4ecf1514d0281adbe8b4e97ef511 (diff) |
Try to set referrer attribution cookie when leaving the page if no tracking request was sent yet (#19200)
* Try to set referrer attribution cookie when leaving the page if no tracking request was sent yet
* rebuilt piwik.js
* Adds js test
Diffstat (limited to 'tests')
-rw-r--r-- | tests/javascript/index.php | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/tests/javascript/index.php b/tests/javascript/index.php index c9a1b15e71..a78ba1784d 100644 --- a/tests/javascript/index.php +++ b/tests/javascript/index.php @@ -3630,6 +3630,24 @@ if ($mysql) { }, 6000); }); + test("referrer attribution without tracking", function() { + expect(6); + + // Check visitor referrer attribution cookie is set on unload without a tracking request + var tracker = Piwik.getTracker(); + tracker.setTrackerUrl("matomo.php"); + tracker.setSiteId(1); + tracker.setReferrerUrl('http://www.google.fr/?query=test'); + equal( tracker.getAttributionReferrerUrl(), "", "getAttributionReferrerUrl() is empty on load") + tracker.hook.test._beforeUnloadHandler(); + equal( tracker.getAttributionReferrerUrl(), 'http://www.google.fr/?query=test', "getAttributionReferrerUrl() is set after unload") + + var tracker2 = Piwik.getTracker(); + tracker2.setTrackerUrl("matomo.php"); + tracker2.setSiteId(1); + tracker2.setReferrerUrl(''); + equal( tracker2.getAttributionReferrerUrl(), 'http://www.google.fr/?query=test', "getAttributionReferrerUrl() should be read from cookie in new tracker") + }); test("tracking", function() { expect(178); |