Page tree

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Migration of unmigrated content due to installation of a new plugin

D toc
Excerpt

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).

Info

NOTE: When the DOMAIN function parses a multi-tiered top-level domain such as co.uk, the output is the first part of the domain value (e.g. co). To return other parts of the domain information, you can use the HOST function. See HOST Function.

D s
snippetBasic

URL literal examples:

D code

derive type:single value:DOMAIN('http://www.example.com' ) as: 'myDomain'

Output: Generates a column containing the value example

D code

derive type:single value:DOMAIN('http://www.exampl.e.com' ) as: 'myDomain'

Output: Generates a column containing the value e

Column reference example:

D code

derive type:single value:DOMAIN(myURLs) as: 'myDomain'

Output: Generates the new myDomain column containing the domain values extracted from the myURLs column. 

D s
snippetSyntax

D code

derive type:single value:DOMAIN(column_url)

ArgumentRequired?Data TypeDescription
column_urlYstringName of column or String or URL literal containing the domain value to extract

D s lang notes

column_url

Name of the column or URL or String literal whose values are used to extract the domain value.

  • Missing input values generate missing results.
  • Multiple columns and wildcards are not supported.

D s
snippetusage

 

Required?Data TypeExample Value
YesString literal or column reference (URL)http://www.example.com

D s
snippetExamples

Example - Filter out internal users

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.

NameReferrer
Joe Guyhttp://www.example.com
Ian Holmeshttp://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

Transform:

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:

D code

derive type:single value:IF(DOMAIN(Referrer)=='test-value',true,false) as:'isInternal'

Now that these values are flagged, you can filter out the internal names:

D code

delete row:(isInternal == 'true')

Results:

NameReferrerisInternal
Joe Guyhttp://www.example.comfalse
Axel Adamshttp://www.example.comfalse
Teri Townshttp://www.example.com/test-valuefalse

Example - Domain, Subdomain, Host, and Suffix functions

Include Page
EXAMPLE - Domain Functions
EXAMPLE - Domain Functions

D s also
labelother