If your site makes use of custom domains, then you may need to implement the domain parameter. The domain parameter should be passed as part of the __reach_config. It should be set as the custom domain on the pages that are loaded via custom domain and as the primary domain when the page is being loaded via the primary domain.
So if you are loading http://custom.mydomain.com/foo/bar, then the domain should be set to custom.mydomain.com.
If the URL is http://mydomain.com/foo/baz, then the domain should be set to mydomain.com. Note that this should not be done with JS on the client side, but should be done on the server side. The reason for this is to attempt to ensure things like web page translator's domains (such as Google Translate) do not get counted multiple times.