Finds the value for the domain from a valid URL. Input values must be of URL or String type. |
In this implementation, a domain value is all data between 1) the protocol identifier (if present) and the sub-domain and 2) the trailing, top-level domain information (e.g. .com
).
NOTE: When the |
URL literal examples:
domain('http://www.example.com') |
Output: Returns the value example
.
domain('http://www.exampl.e.com') |
Output: Returns the value e
.
Column reference example:
domain(myURLs) |
Output: Returns the domain values extracted from the myURLs
column.
domain(column_url) |
Argument | Required? | Data Type | Description |
---|---|---|---|
column_url | Y | string | Name of column or String or URL literal containing the domain value to extract |
Name of the column or URL or String literal whose values are used to extract the domain value.
Required? | Data Type | Example Value |
---|---|---|
Yes | String literal or column reference (URL) | http://www.example.com |
Here is some example web visitor information, including the name of the individual and the referring URL. You would like to filter out the internal users, whose referrer values include test-value
.
Name | Referrer |
---|---|
Joe Guy | http://www.example.com |
Ian Holmes | http://www.test-value.com/support |
Nick Knight | http://www.test-value.com |
Axel Adams | http://www.example.com |
Teri Towns | http://www.example.com/test-value |
Transformation:
The referrrer values include test-value
as a non-domain value and varying URLs from the test-value.com domain. So, you should use the DOMAIN
function to parse only the domain versions of these values. The following evaluates the Referrer
column values for the test-value
domain and generates true/false answers in a new column accordingly:
Now that these values are flagged, you can filter out the internal names:
Results:
Name | Referrer | isInternal |
---|---|---|
Joe Guy | http://www.example.com | false |
Axel Adams | http://www.example.com | false |
Teri Towns | http://www.example.com/test-value | false |