Where is the visitor id and session id in query params when event goes to matomo.php?

Hi @pkr2
I really don’t understand your last need… Do you want Matomo check the incoming data? It can’t.
If you just want to track e-commerce:

If you want to add a custom dimension (either action or visit dimension):
https://developer.matomo.org/guides/tracking-javascript-guide#custom-dimensions

@heurteph-ei
@Leo1
Thanks for giving me your time to reply
Yes, I want Matomo to check the incoming data according to their corresponding schema. Schema where i can define the fields which are required or which are optional while capturing events like add to cart.
For eample:

 _paq.push([
            "trackEvent",
            "Category",
            "addToCart",
            JSON.stringify({
              product_id: "P12345",
              product_name: "Gaming Console PS5",
              product_price: 50000.99,
              product_qty: 1,
            }),
          ]);

this above code contains the event addToCart, so the fields im mentioning it here product_id, product_name etc that fields i want to mention in the matomo schema
which fields are required or not

my second question is does this ecommerce plugin provide the same asked facility for validation of upcoming js events according to the schema?
and this ecommerce plugin is expandable , can we customize it according to our requirement ?

@heurteph-ei
@Leo1
I am getting a very unexpected behavior with the visitId, please guide me why this is happening
I am getting two different visitor Id having same visitId (39)
chrome in normal mode:
visitorId 80b16aafbb1042b3
SessionID 39
chrome in incognito mode at the same time
visitorId 9eb522d209d49d89
SessionID 39

Below is my code

 <head>
       <script type="text/javascript">
      // Matomo Start
      var _paq = (window._paq = window._paq || []);
      /* tracker methods like "setCustomDimension" should be called before "trackPageView" */
      _paq.push(["enableHeartBeatTimer"]);
      _paq.push(["trackPageView"]);
      _paq.push(["enableLinkTracking"]);
      
      (function () {
        var u = "//localhost/matomo-4.14.1/matomo/";
        _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);
      })();
      // / Matomo Config End
    </script>
  </head>
$("#btnMatomoVisitId").click(function () {
          if (typeof _paq !== "undefined") {
            // Wait for Matomo to finish loading
            
            var visitor_id;
            _paq.push([ function() { visitor_id = this.getVisitorId(); }]);
            console.log("visitorId", visitor_id);
            var request = new XMLHttpRequest();
            request.onreadystatechange = function () {
              if (this.readyState == 4 && this.status == 200) {
                var response = JSON.parse(this.responseText);
                if (response.lastVisits.length > 0) {
                  var visitId = response.lastVisits[0].idVisit;
                  console.log("SessionID", visitId);
                } else {
                  console.log("No visits found.");
                }
                console.log("response", response)
              }
            };
            request.open(
              "GET",
              "http://localhost/matomo-4.14.1/matomo/index.php?module=API&method=Live.getVisitorProfile&idSite=1&visitorId="+visitor_id+"&limitVisits=1&format=json&token_auth=87eb297419e2605b7a18342e2dfed373"
            );
            request.send();
          } else {
            console.log("Matomo tracking code not loaded yet.");
          }
        });

Please guide me why different visitorId having same sessionId or visitId

Thanks

and 2nd unexpected behavior is when I close my normal chrome window
and reopen it normal chrome window
On first button click to get visitId is

visitorId 80b16aafbb1042b3
SessionID 39
response {visitorId: '80b16aafbb1042b3', hasMoreVisits: false, totalVisits: 23, totalVisitDuration: 18127, totalActions: 120, …}

On 2nd time button clicked to get visitId:

visitorId 80b16aafbb1042b3
SessionID 35
response {visitorId: '80b16aafbb1042b3', hasMoreVisits: false, totalVisits: 22, totalVisitDuration: 16905, totalActions: 118, …}

Now this time is sessionId 39 to 35 … downward?

Hi @pkr2
About the data validation, as previously written, Matomo won’t do that. Except if you develop your own plugin.
About the visitor/session, Matomo tries to reconciliate the visitor, according to the configuration, thanks to visit data (either from cookie or from IP+browser info or…?). Then it can consider the visitor is the same in some conditions…