This module allows sites protected by the require login module (8.x-1.12 or greater) to select which domain names to require users to login to and which can allow anonymous access.
A couple of use cases for this are:
Edit Security
In this case, the public site (www.example.com) should be accessible via anonymous access but not allow user login or other admin access.
Admin access should only be allowed via edit.example.com, a separate DNS entry that points to the same site. Access to the site via this domain should require users to login first. No anonymous access.
This module will help you prevent the loading of specific parts and related scripts of a page until consent for placing Cookies and related technologies is given.