SinceAs a topological invariant, the integral is invariant under perturbations $A\mapsto A+\delta A$ of $A$. Since each $A$ is the connection on some $G$-principal bundle over $M^d$ and the space of connections on a given bundle is an affine vector space hence contractible and in particular connected, asevery connection on a topological invariantgiven bundle can be reached by repeatedly perturbing every other connection. Therefore, the integral is constant for all $A$ coming from the same bundle and it's a really just a function onof equivalence classes of principal $G$-bundles, and sincebundles.
Since those classes are given by (homotopy classes of) maps $M^d \to \mathrm{B}G$ from the manifold into the classifying space, which are $d$-cycles in $\mathrm{B}G$ (they are (singular) cycles because a manifold is boundaryless), it is a function assigning values in $\mathrm{U}(1)$ to $d$-cycles. If it is trivial on $d$-boundaries, which I think it should be but can't currently prove, then it is a function $H^d(\mathrm{B}G)\to \mathrm{U}(1)$ and since $\mathrm{U}(1)$ is a divisible group, its ext functor vanishes and by the universal coefficient theorem we have that this is actually a $\mathrm{U}(1)$-valued $d$-cocycle.
Since the $d$-th cohomology of $\mathrm{B}G$ is the $d$-th group cohomology of $G$, this would explain that the integral can be viewed as a group cocycle if we can show that it is zero on $d$-boundaries in $\mathrm{B}G$.