A chemical which the female releases into the foam as she is laying the eggs is the deciding factor.
(she; is laying; the eggs) (A chemical; is; the deciding factor)
she A chemical
is laying is
the eggs
the deciding factor