Let $G$ be a semi-simple Lie group. By Cartan's criterion its Killing form $B(X,Y)$ on $\frak g$ is non-degenerate. We can use it to define an inner product on the whole group by left translation
$${\cal G}(X,Y)=B((L_g^{-1})_{\ast}X,(L_g^{-1})_{\ast}Y),\quad X,Y\in T_gG.$$
For matrix groups both $g$ and $X$ are matrices and we have $(L_g^{-1})_{\ast}X=g^{-1}X$. Moreover after a suitable normalization the Killing form becomes just a trace so that $${\cal G}(X,Y)=\operatorname{tr}(g^{-1}Xg^{-1}Y),\quad X,Y\in T_gG.$$
All that said, if $\varphi:\Sigma\to G$ is a smooth embedding we have that
$$({\varphi^\ast {\cal G}})(X,Y)=X^a X^b\operatorname{tr}(g^{-1}\partial_a g g^{-1}\partial_b g),\quad X,Y\in T_z \Sigma$$
In that case the Polyakov action on $G$ is simply $$S_P = \dfrac{1}{4\pi\alpha'}\int_\Sigma d^2\sigma \sqrt{h} h^{ab}\operatorname{tr}(g^{-1}\partial_a g g^{-1}\partial_b g).$$
This is harnessed for example in AdS$_3$ to connect string theory in AdS$_3$ to a WZW model, by recalling that AdS$_3\simeq \mathrm{SL}(2,\mathbb{R})$.
On the other hand the WZW action has two parts. The first is exactly what we have found, and it is just the Polyakov action in disguise. The second is the WZ term, that is important for the quantum theory to be conformal. I want to understand what the WZ term means for the string theory. Since it should be there for the theory to be conformal, I feel it must be related to the compact ${\cal M}$ that appears when we consider instead AdS$_3\times {\cal M}$. After all, already in flat space we know that for the theory to be conformal there are constraints on the dimension, and therefore a second factor increasing the dimension seems to be what is required.
On the other hand, the WZ term is written in terms of an extension of $g$ into a three-dimensional manifold with boundary $\Sigma$. Here $g$ is the worldseet embedding in AdS$_3$. So it seems the WZ term is just related to the worldsheet embedding and just to AdS$_3$, which is probably wrong and a result of me missing something.
So what is really the meaning of the WZ term for string theory on group manifolds like AdS$_3$ and how can we clearly see it like we clearly see above that the Polyakov action takes exactly the WZW form on such group manifolds?