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
path: root/js
diff options
context:
space:
mode:
authorMichaelHeerklotz <michael.heerklotz@web.de>2020-06-29 04:20:35 +0300
committerGitHub <noreply@github.com>2020-06-29 04:20:35 +0300
commitbe326c4abd2fd8b9958009dbe99802f378255c35 (patch)
treed7e4bdcc2de3ce8f3192340c172e08884987e518 /js
parentf59f2eaff60e4dce5d3fc7f350fdb55f830ce0a0 (diff)
Fix 3rd party cookie / global visitorid race condition: set 3rd party cookie during js code fetch (#13109)
Co-authored-by: Michael Heerklotz <michael.heerklotz@check24.de>
Diffstat (limited to 'js')
-rw-r--r--js/tracker.php13
1 files changed, 13 insertions, 0 deletions
diff --git a/js/tracker.php b/js/tracker.php
index ce9793b9cc..4e5ac618c3 100644
--- a/js/tracker.php
+++ b/js/tracker.php
@@ -67,6 +67,19 @@ $environment = new \Piwik\Application\Environment(null, array(
));
$environment->init();
+if (!\Piwik\Tracker\IgnoreCookie::isIgnoreCookieFound()) {
+
+ $request = new \Piwik\Tracker\Request(array());
+
+ if ($request->shouldUseThirdPartyCookie()) {
+ $visitorId = $request->getVisitorIdForThirdPartyCookie();
+ if (!$visitorId) {
+ $visitorId = \Piwik\Common::hex2bin(\Piwik\Tracker\Visit::generateUniqueVisitorId());
+ }
+ $request->setThirdPartyCookie($visitorId);
+ }
+}
+
ProxyHttp::serverStaticFile($file, "application/javascript; charset=UTF-8", $daysExpireFarFuture, $byteStart, $byteEnd);
exit;