It may be hard to explain but it will take the root domain and use that. I can shoot some examples and that may be easier.
mail.smartertools.com -> smartertools.com
we.are.smartermail.com -> smartermail.com
We pull from the address bar and do some parsing of the URL to get to root domain, we then match that up with what is in SmarterMail.