@olleharstedt opened this Issue on April 27th 2018

Reading the docs, it seems like there's no setVisitorId in the JavaScript tracking API. Any reason for this? I have a big problem with a mismatch between the visitor id returned by the PHP API and the one returned by the JavaScript, which makes part of our logic unusable. I was hoping to bridge this mismatch by setting the visitor id = the one I got from the PHP API.

@yohannprigent commented on May 13th 2020

Any news on that ? It seems the method is public...

@tsteur commented on May 13th 2020 Member

@yohannprigent you can't set the visitorId yet but a userId if that helps: https://matomo.org/docs/user-id

Not 100% sure why the method isn't public yet but maybe cause we'd then need to update the cookie again etc and there could be some complications if the setVisitorId is called too early when cookies aren't configured yet fully (eg cookie path, domain, ...) or if the idSite is still missing etc but we could kind of control this internally when it will be called. I guess it's just a bit more complicated then having this method public.

Would you expect this method to persist the visitorId in a cookie @yohannprigent ? Might be good to let us know a bit more about your use case so we can better understand things.

@yohannprigent commented on May 13th 2020

My use case is essentially to keep a consistent visitorId between different websites, on different subDomains. Matomo provides a great enableCrossDomainLinking function, but it's sad this functionality automatically stop tracking Outlinks from domains defined with setDomains, even if we don't want.
So I was thinking having a way to define a visitorId I would get from the other Matomo cookie on the other website (but on the same cookie domain). This is my use-case today, but I think if Matomo tracker would allow to select if we want outlinks from domainAlias to be tracked, my use case would not need to exist.

So yes, it would persist within the cookie in my opinion, as setSiteIddoes.

@tsteur commented on May 13th 2020 Member

Matomo provides a great enableCrossDomainLinking function, but it's sad this functionality automatically stop tracking Outlinks from domains defined with setDomains, even if we don't want.

Do you know if we have an issue for this already? Are you saying you define eg

setDomains(foo.bar, example.bar)

Then you want example.bar to be still tracked an outlink? Is this basically because they aren't tracked into the same site in Matomo but different sites?

@yohannprigent commented on May 13th 2020

@tsteur Totally correct. Different domains tracked into different websites.
At my knowledge, we don't have issue for that.
What makes me sad is that we have two different checkboxes on the tracking code configuration : one to hide from outlinks (screenshot), and one for the crossDomain. The crossDomain automatically applies the "hide from outlinks"... This should be a separate option, as it is a separate checkbox here.
I could submit a PR to add an option to track outlinks even if they are to a domain defined within setDomains. From what I see in the tracker, this should be a light add.

Screenshot 2020-05-14 at 00 13 04
@tsteur commented on May 15th 2020 Member

@olleharstedt be good to at least create an issue for it for now 👍 We'd then need to see how we could make this work. I presume we'd want to keep existing behaviour by default and any set domain would be used for both purposes, unless setting some other domains for cross domain specifically.

Powered by GitHub Issue Mirror