Quantum criticality in iron pnictides involves both the nematic and antiferromagnetic degrees of freedom, but the relationship between the two types of fluctuations has yet to be clarified. Here we study this problem in the presence of a small external uniaxial potential, which breaks the $C_4$-symmetry in the B$_{1g}$ sector. We establish an identity that connects the spin excitation anisotropy, which is the difference of the dynamical spin susceptibilities at $vec{Q}_1=left(pi,0right)$ and $vec{Q}_2=left(0,piright)$, with the dynamical magnetic susceptibility and static nematic susceptibility. Using this identity, we introduce a scaling procedure to determine the dynamical nematic susceptibility in the quantum critical regime, and illustrate the procedure for the case of the optimally Ni-doped BaFe$_2$As$_2$[Y. Song textit{et al.}, Phys. Rev. B 92, 180504 (2015)]. The implications of our results for the overall physics of the iron-based superconductors are discussed.