When I try to dynamically add the Matomo idSite field in the Matomo Configuration Variable, based on a data layer variable read in a custom JS variable, I receive an error:
It would be great to be able to set different site IDs for each environment dynamically by using a case statement (or lookup table) to lookup which environment is populated in the data layer and allow the variable value to be used as the site ID.
For example to be able to create a Custom JavaScript variable like this:
function () {
var _mtmId;
switch(dataLayer[0].app.systemEnvironment) {
case "ci":
_mtmId = "2";
break;
case "si":
_mtmId = "2";
break;
case "uat":
_mtmId = "2";
break;
case "staging":
_mtmId = "2";
break;
case "prod":
_mtmId = "1";
break;
default:
_mtmId = "2";
}
return _mtmId;
}
To assign the Matomo idSite field in the Matomo Configuration Variable. If this functionality already exists and I am just approaching it the wrong way, please let me know,