Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

No setVisitorId in JavaScript tracking API? #12777

Closed
olleharstedt opened this issue Apr 27, 2018 · 7 comments
Closed

No setVisitorId in JavaScript tracking API? #12777

olleharstedt opened this issue Apr 27, 2018 · 7 comments
Labels
Enhancement For new feature suggestions that enhance Matomo's capabilities or add a new report, new API etc.
Milestone

Comments

@olleharstedt
Copy link

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.

@y0hnn
Copy link

y0hnn commented May 13, 2020

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

@tsteur tsteur added the Enhancement For new feature suggestions that enhance Matomo's capabilities or add a new report, new API etc. label May 13, 2020
@tsteur
Copy link
Member

tsteur commented May 13, 2020

@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.

@y0hnn
Copy link

y0hnn commented May 13, 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
Copy link
Member

tsteur commented May 13, 2020

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?

@y0hnn
Copy link

y0hnn commented May 13, 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
Copy link
Member

tsteur commented May 15, 2020

@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.

@mattab
Copy link
Member

mattab commented Jun 12, 2020

Added in #16042 - will be available in 3.13.7

@mattab mattab closed this as completed Jun 12, 2020
@mattab mattab added this to the 3.13.7 milestone Jun 12, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Enhancement For new feature suggestions that enhance Matomo's capabilities or add a new report, new API etc.
Projects
None yet
Development

No branches or pull requests

4 participants