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.