If you set your own cookie with the domain "mydomain.com", it will be visible only in this domain (without subdomains). If you set your own cookie as ".mydomain.com" (prefixed with a dot), then it will be visible to "mydomain.com" and any subdomain of mydomain.com.
GA cookie , , "www.mydomain.com", "www.mydomain.com", "mydomain.com" - . , , , GA "mydomain.com" , . , , cookie . , GA .
.