In electrodynamics, the current-current interaction in the momentum space is described by
$$p^2 A_\mu J^\mu = J_\mu J^\mu \, ,$$
where $J$ denotes an arbitrary external current. Since photon-mediated interactions respond only to the transverse part of the current, we can write
$$ J_\mu J^\mu = J^\mu \Pi_{\mu\nu} J^\nu \, $$
where we define $\Pi_{\mu\nu}$ as a projection operator that projects an on-shell current to its transverse part,
$$ \Pi_{\mu\nu} = \eta_{\mu\nu} - p_\mu \bar{p}_\nu - p_\nu \bar{p}_\mu \, ,$$
where $p$ denotes the exchanged on-shell momentum ($p^2=0$) and $\bar{p}$ denotes some vector such that $\bar{p}^2 = 0$ and $p \cdot \bar{p} = 1$.
Now, obviously,
$$\eta_{\mu\nu} \Pi^{\mu\nu} = D - 2 \, , $$
in $D$-dimensional spacetime. The claim is that the trace of $\Pi$ counts the number of degrees of freedom (polarizations) that take part in the current-current interaction, without fixing the gauge.
This isn't so obvious to me, could someone give it a shot and try to explain it?