I might suggest creating multiple properties as how complex it can get when you start having multiple sites.
You technically don't want to be loading a large launch library for sites that may not need be needing that code.
But for maintainability, it might be worth building some mechanisms to do that.
I would start with a Data Element (let's call it subSite) that checks which site you are on.
var pathArray = window.location.pathname.split('/');
// Check the first level. Or whatever how you define the sub-site
if (pathArray[1]) {
return pathArray[1]; // Returns the name of the first subfolder
} else {
return ""; // Returns this if no subfolder is found
}
So in your example if you have domain/website1 and domain/website2, you can then use this DE to check like this:
if (_satellite.getVar("subSite") === "website1") {
// Do the code for website 1
}
Or you can use Rule Conditions to go:
These are the basics. Some things to consider:
1. Instead of using multiple rules, you can have an associative array for the website for all the IDs such as gtag codes so you aren't having to paste the multiple GTAG Libraries, Meta Pixels etc. and just replace the ID based on the subSite you are on.
2. Since you are relying on subfolder, it can break easily if it doesn't follow the convention
3. Ideally build out a client dataLayer https://experienceleague.adobe.com/docs/experience-manager-learn/sites/integrations/adobe-client-dat...