Creating an "all subdomains" variable?

Bronze Contributor
Bronze Contributor
Hi, Quick question -- we're just getting started, so I apologize if this is obvious. For a tag we're working with, I need to create a variable that we can map to that covers all of our site's subdomains, specifically requested to be: ".ourdomain.com" What's the best/correct way to create this variable with the preceding . and specified domain, so I can use as a data source for mapping? Thanks! Laura
4 REPLIES 4

Creating an "all subdomains" variable?

Employee Emeritus
Hi Laura, can you clarify your question a bit? For instance, if you can, what tag are you working with? what's the use case for the subdomain data source? Any additional detail you could give would be helpful because it's not quite clear (yet) what you're requirement is. If you can't provide additional detail here, I'd recommend reaching out to your account manager so that you can have a direct conversation about what you're trying to accomplish.

Creating an "all subdomains" variable?

Employee Emeritus
Hi Laura, In your request ".ourdomain.com" will actually contain the root domain and not the subdomain. Subdomains will look like this "test.ourdomain.com" or "staging.ourdomain.com". If your tag requested you to pass in the subdomain you might want to pass in 'test.ourdomain.com' or 'staging.ourdomain.com' for example. Passing in '.ourdomain.com' would be the same as passing the root domain of your site. --- To answer your question, you can store the current domain into a data source variable and be able to manipulate it to the format you like. In Tealium, there is a data source called 'domain' that will be able to grab all of your sites domains including the subdomain (this will take you halfway there?) However, if you need to have the exact format like above you will have to use javascript to manipulate the format. Depending on how many subdomains your sites will have the javascript might be different. For example here are some different examples that can be stored inside the 'domain' data source: test1.staging1.ourdomain.com staging2.ourdomain.com test.ourdomain.com www.ourdomain.com I hope this gives you more direction in what you are trying to accomplish. Please reach out to your account manager if you like to discuss in more detail.

Creating an "all subdomains" variable?

Bronze Contributor
Bronze Contributor
Hi Clint, It's the Mercent tag -- the tag specs were to map "Cookie Domain" to ".ourdomain.com" (obviously updating "ourdomain" with the correct domain of our site). They specifically called out to use that format in their tag, if we have more than 1 subdomain on our site--just trying to figure out how best to add this. Is it possible to just hardcode/type that in and map to Cookie Domain (creating a variable and then saying the variable always = .ourdomain.com)? Thanks!

Creating an "all subdomains" variable?

Employee Emeritus
Hi Laura, In that case (it sounds like Mercent wants to use the parent domain to track behavior across all of your sub domains) the simplest solution would be to 1) add a data source (type UDO Variable) called something like "mercent_domain" 2) add a Set Data Values extension to set mercent_domain to the static value yourdomain.com 3) set the scope to your Mercent tag 4) map mercent_domain to the appropriate destination in the Mercent tag
Public