function parseDomain(referrer) {
  if (!referrer || !isBrowser) return false

  let referringDomain = getDomainBase(referrer)
  const a = document.createElement('a')
  a.href = referrer

  // Shim for the billion google search engines
  if (a.hostname.indexOf(googleKey) > -1) {
    referringDomain = googleKey
  }

  // If is search engine
  if (searchEngines[referringDomain]) {
    const searchEngine = searchEngines[referringDomain]
    const queryParam = (typeof searchEngine === 'string') ? searchEngine : searchEngine.p
    const termRegex = new RegExp(queryParam + '=.*?([^&#]*|$)', 'gi')
    const term = a.search.match(termRegex)

    return {
      source: searchEngine.n || trimTld(referringDomain),
      medium: 'organic',
      term: (term ? term[0].split('=')[1] : '') || '(not provided)'
    }
  }

  // Default
  const medium = (!isExternalReferrer(referrer)) ? 'internal' : 'referral'
  return {
    source: a.hostname,
    medium: medium
  }
}
Client side domain parser for determining marketing data.
@param  {String} referrer - ref url
@return {DomainObject | boolean}