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

[Bug] some visit log missing UserId #22755

Open
4 tasks done
darkSheep404 opened this issue Nov 13, 2024 · 2 comments
Open
4 tasks done

[Bug] some visit log missing UserId #22755

darkSheep404 opened this issue Nov 13, 2024 · 2 comments
Labels
Potential Bug Something that might be a bug, but needs validation and confirmation it can be reproduced. To Triage An issue awaiting triage by a Matomo core team member

Comments

@darkSheep404
Copy link

What happened?

we using js code to set useid in our vue app
and most page of our app need login to view
but we see some tracking log without username, and visited those page which need login

When does this happen, is it because the first few pages a user visits are pre-login pages ?

    <!-- Matomo -->
    <script>
      var _paq = window._paq = window._paq || [];
      var userString = localStorage.getItem('user');
      if (userString) {
        let userObject = JSON.parse(userString);
        let username = userObject.username;
        _paq.push(['setUserId', username]);
      }
      /* tracker methods like "setCustomDimension" should be called before "trackPageView" */
      _paq.push(['trackPageView']);
      _paq.push(['enableLinkTracking']);
      (function() {
        var u="/xxxx.com/";
        _paq.push(['setTrackerUrl', u+'matomo.php']);
        _paq.push(['setSiteId', '1']);
        var d=document, g=d.createElement('script'), s=d.getElementsByTagName('script')[0];
        g.async=true; g.src=u+'matomo.js'; s.parentNode.insertBefore(g,s);
      })();
    </script>
    <!-- End Matomo Code -->

What should happen?

visit log which visited pages after login in should have userid logged

How can this be reproduced?

currenly no idea

Matomo version

5.0.3

PHP version

8.0.30

Server operating system

docker

What browsers are you seeing the problem on?

Chrome

Computer operating system

windows

Relevant log output

No response

Validations

@darkSheep404 darkSheep404 added Potential Bug Something that might be a bug, but needs validation and confirmation it can be reproduced. To Triage An issue awaiting triage by a Matomo core team member labels Nov 13, 2024
@darkSheep404 darkSheep404 changed the title [Bug] missing UserId [Bug] some visit log missing UserId Nov 13, 2024
@sgiehl
Copy link
Member

sgiehl commented Nov 13, 2024

could be related to #19927

@darkSheep404
Copy link
Author

darkSheep404 commented Nov 14, 2024

hi @sgiehl
Thanks for your help

But things are a little different,
The main point of this #19927 issue should be that pre-login and post-login access are split into two different VisiTiDs

But when we run into problems
There are some post-login access records with no userid
(Sometimes the same behavior records the userid,sometime not)
Because those pages can only be accessed after login
So visiting these pages without a userid is clearly not normal

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Potential Bug Something that might be a bug, but needs validation and confirmation it can be reproduced. To Triage An issue awaiting triage by a Matomo core team member
Projects
None yet
Development

No branches or pull requests

2 participants