This is an idle question inspired by wondering if one could further generalise @ClarkLyons's generalisation of an answer of @diracdeltafunk.
Of course, every finite group has a faithful, finite-dimensional representation (say, its regular representation), which is to say, every finite group admits an injective homomorphism into some $\operatorname{GL}_n(\mathbb C)$. (I'm used to complex representations, but we can consider the regular representation over any field.)
For which finite groups $G$ is there a representation $\pi : G \to \operatorname{GL}_n(\mathbb C)$ such that $g \mapsto \operatorname{tr} \pi(g)$ is injective on conjugacy classes? How much does the answer change if we replace $\mathbb C$ by the algebraic closure of $\mathbb F_p$?