Custom Variable Template for Google Tag Manager
Returns root domain from hostname or URL
Specify a URL or hostname (from standard Page URL or Page Hostname variables for example). The variable returns the root domain. It uses a Tag Manager Template API to get the hostname and identifies the root domain like demonstrated here: https://gist.github.com/RavenHursT/fe8a95a59109096ac1f8?permalink_comment_id=3869493#gistcomment-3869493