domain
Extracts the hostname from a URL. Syntaxurl— the URL to parse, as a string.
- The hostname as a string, or an empty string if the URL cannot be parsed.
Edge divergence: on ClickHouse
domain() returns an empty string for URLs that contain userinfo (user:pass@host), whereas the PostgreSQL idiom extracts the host. Use URLs without userinfo for cross-backend parity.Group users by the host of their website
domainWithoutWWW
Returns the hostname of a URL with any leadingwww. removed.
Syntax
url— the URL to parse, as a string.
- The hostname without a leading
www.as a string, or an empty string if the URL cannot be parsed.
Normalize the referrer host across www and non-www
path
Returns the path of a URL, without the query string. Syntaxurl— the URL to parse, as a string.
- The path as a string (for example
/docs/lists). Empty if the URL has no path.
Count events by the page path that was visited
queryString
Returns the query string of a URL, without the leading? and without any # fragment.
Syntax
url— the URL to parse, as a string.
- The query string as a string (for example
utm_source=newsletter&plan=pro), without the leading?. Empty if the URL has no query string.
Inspect the tracking parameters on referrer URLs
protocol
Extracts the protocol (scheme) from a URL. Syntaxurl— the URL to parse, as a string.
- The protocol as a string (for example
https,http,ftp,mailto). Empty if it cannot be determined.
Segment users whose website is served over HTTPS
port
Returns the port of a URL. Syntaxurl— the URL to parse, as a string.default_port— optional value returned when the URL has no port; defaults to0.
- The port number as an integer, or
default_port(or0) when the URL contains no port or cannot be parsed.
Edge divergence: on ClickHouse
port() returns 0 for URLs that contain userinfo (user:pass@host:port), whereas the PostgreSQL idiom extracts the port correctly. Use URLs without userinfo for cross-backend parity.Find users whose website URL specifies a non-standard port
topLevelDomain
Extracts the top-level domain (TLD) from a URL. Syntaxurl— the URL to parse, as a string.
- The top-level domain as a string (for example
com,io), or an empty string if the URL cannot be parsed.
Group users by the top-level domain of their website
fragment
Returns the fragment identifier of a URL (the part after#), without the leading hash.
Syntax
url— the URL to parse, as a string.
- The fragment as a string, without the leading
#. Empty if the URL has no fragment.
Find users whose landing URL points at a specific section