Noticed this when testing on our site with cookies disabled. Basically in this case there is no visitorId unless a user sets it manually.
getCrossDomainVisitorId() was then only returning the
device ID but not the visitorId and thus the generated link was invalid.
Tried to add a test like
tracker.setVisitorId(null); // also tried empty string etc tracker.setSiteId(99); replacedUrl = makeReplaceHrefForCrossDomainLink('http://www.example.com/'); strictEqual(null, replacedUrl, 'replaceHrefForCrossDomainLink, should not return a link when visitorId not set');
but wasn't possible because the site had a cookie already set and Matomo would then always use that cookie overwriting any custom set value when the value is empty
Shouldn't be needed the test anyway.