public function parseUrl($referer)
    {
        if (is_null($referer)) return null;

        $parsed = parse_url($referer);
        $parts  = explode('.', $parsed['host']);
        $domain = array_pop($parts);

        if (count($parts) > 0)
            $domain = array_pop($parts).'.'.$domain;

        return [
            'url'    => $referer,
            'domain' => $domain,
            'host'   => $parsed['host'],
        ];
    }