We prove that a compact space $K$ embeds into a $\sigma$-product of compact metrizable spaces ($\sigma$-product of intervals) if and only if $K$ is (strongly countable-dimensional) hereditarily metalindel\"of and every subspace of $K$ has a nonempty relative open second-countable subset. This provides novel characterizations of $\omega$-Corson and $NY$ compact spaces. We give an example of a uniform Eberlein compact space that does not embed into a product of compact metric spaces in such a way that the $\sigma$-product is dense in the image. In particular, this answers a question of Kubi\'s and Leiderman. We also show that for a compact space $K$ the property of being $NY$ compact is determined by the topological structure of the space $C_p(K)$ of continuous real-valued functions of $K$ equipped with the pointwise convergence topology. This refines a recent result of Zakrzewski.