Consider a gauge theory with group $G$. The canonical kinetic term for the gauge field is $F\wedge\star F$ and, depending on the dimensionality of spacetime, there are other allowed terms, such as Chern-Simons terms in odd dimensions. There is also a special type of terms that is allowed, the so-called theta terms, which are non-perturbative in nature (typically total derivatives) and topological.
Where do these terms live? I suspect they live in $H^d(BG,\mathbb Z)$ but I'm not sure. For simply connected $G$ this is spanned by the corresponding Chern classes, and so this group seems to agree with the standard theta terms. But when the group is not simply connected we have torsion elements, and I'm not sure these always lead to meaningful theta terms. Conversely, I don't know whether all admissible theta terms arise this way either. So, is $H^d(BG)$ the correct object? Or where do these theta terms live?