Let $f\colon\thinspace G\to H$ be a surjective homomorphism of finitely generated groups. Are there any methods to decide whether $f$ factors through a free group? That is, does there exist a free group $F$ and homomorphisms $g\colon\thinspace G\to F$ and $h\colon\thinspace F\to H$ such that $f=h\circ g$?
I know of one necessary condition, given by cohomology. If $f$ factors through a free group then $f^*\colon\thinspace H^i(H;M)\to H^i(G;M)$ is zero for all $i>1$ and all $H$-modules $M$ (since free groups have cohomological dimension one).
This question was inspired by Tom Goodwillie's answer to my earlier question on cohomological dimension of group homomorphisms.