  We consider families of number fields of degree 4 whose normal closures over
$\mathbb{Q}$ have Galois group isomorphic to $D_4$, the symmetries of a square.
To any such field $L$, one can associate the Artin conductor of the
corresponding 2-dimensional irreducible Galois representation with image $D_4$.
We determine the asymptotic number of such quartic $D_4$-fields ordered by
conductor, and compute the leading term explicitly as a mass formula, verifying
heuristics of Kedlaya and Wood. Additionally, we are able to impose any local
splitting conditions at any finite number of primes (sometimes, at an infinite
number of primes), and as a consequence, we also compute the asymptotic number
of order 4 elements in class groups and narrow class groups of quadratic fields
ordered by discriminant.
  Traditionally, there have been two approaches to counting quartic fields,
using arithmetic invariant theory in combination with geometry-of-number
techniques, and applying Kummer theory together with L-function methods. Both
of these strategies fall short in the case of $D_4$-fields ordered by conductor
since counting quartic fields containing a quadratic subfield with large
discriminant is difficult. However, when ordering by conductor, we utilize
additional algebraic structure arising from the outer automorphism of $D_4$
combined with both approaches mentioned above to obtain exact asymptotics.
