@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:
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
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…