diff --git a/modules/undertoneBidAdapter.js b/modules/undertoneBidAdapter.js index 1f32fe0347a..d7e063b85f5 100644 --- a/modules/undertoneBidAdapter.js +++ b/modules/undertoneBidAdapter.js @@ -21,11 +21,15 @@ export const spec = { 'x-ut-hb-params': [] }; const location = utils.getTopWindowLocation(); - let domain = /[-\w]+\.(?:[-\w]+\.xn--[-\w]+|[-\w]{3,}|[-\w]+\.[-\w]{2})$/i.exec(location.host); - if (domain == null || domain.length == 0) { - domain = null; - } else { - domain = domain[0]; + let domains = /[-\w]+\.([-\w]+|[-\w]{3,}|[-\w]{1,3}\.[-\w]{2})$/i.exec(location.host); + let domain = null; + if (domains != null && domains.length > 0) { + domain = domains[0]; + for (let i = 1; i < domains.length; i++) { + if (domains[i].length > domain.length) { + domain = domains[i]; + } + } } const pubid = validBidRequests[0].params.publisherId;