First, modern copyright law imposes no requirement to include a copyright notice whatsoever. You could include no copyright notice, and your work would be just as covered by copyright law as a work with a copyright notice. So, yes, it's likely fine to use a domain name in any copyright notice that you choose to include, with a few caveats.
While your copyright is safely intact regradless, you may be forfeiting some procedural advantage by not using your name or a proper peusdonym. For example, in the U.S., per 17 U.S.C. §401(b), a valid copyright notice requires
(3) the name of the owner of copyright in the work, or an abbreviation by which the name can be recognized, or a generally known alternative designation of the owner.
I don't know that a domain name would qualify as an "alternative designation of the owner" (possibly, but I really don't know).
However, even if it does not qualify, the consequences of the invalidity of your notice are virtually zero. The only advantage (in the U.S.) follows in §401(d):
(d)Evidentiary Weight of Notice.—
If a notice of copyright in the form and position specified by this section appears on the published copy [...] then no weight shall be given to such a defendant’s interposition of a defense based on innocent infringement [...]
A valid notice can invalidate an infringer's claim of innocent infringement, and that's really it. You can probably beat a claim of innocent infringement with an almost-valid copyright notice anyway.
A more serious issue is that domain names are often trademarks. Whether registered or not, they signify the source of goods and services. If you don't own the domain you're using (e.g., if I did Copyright 2018 www.google.com
but I don't work for Google) then that could easily be trademark infringement for misrepresenting the source of your code. Of course, you wouldn't tell a baldfaced lie like saying your code came from google.com, but that issue still might arise if you ever abandon the domain. If you forfeit the registration for your chosen domain and someone else buys it to run a completely different site, your code could be legally problematic for claiming association with some foo.com
when you no longer own foo.com
.