By default your project will only accept events from the domain you've verified, and if it's a root domain, it will automatically allow the www. version.
Subdomain tracking allows you to track visitors across subdomains by configuring your project's allowed hostnames. This is useful if you have a single project that serves multiple subdomains, for example a marketing site and a dashboard.
In order to track visitors across subdomains, you need to add the script tag to each subdomain. For example, if your domain is example.com, and you also wish to track app.example.com you need to add the same script tag to both of them.
Replace YOUR_TOKEN with your project token.
By default, this will work anywhere, but it will only track events from hostnames you've configured. No need to change a thing.
Head to your project's security settings and configure the allowed hostnames.

You can add any hostname you like, and you can even use wildcards to allow multiple or all subdomains of a given domain.
*.example.com - All subdomains of example.comapp.example.com - Only app.example.comIf you are using a root domain for your project, the www. version will be automatically allowed—no extra configuration needed.