Open toriumi0118 opened 6 years ago
you can change Quick Start component like this:
if (isBody) {
return gtm.noScriptAsReact();
}
if (isHead) {
return gtm.scriptAsReact();
}
and send isHead and isBody props to GTM like this:
in head component:
<GoogleTagManager isHead={true} gtmId='GTM-...' />
in body component:
<GoogleTagManager isBody={true} gtmId='GTM-...' />
except that in some cases, the backend server isn't node and doesn't run react. Client react is already within the body.
@yepstepz can I assume that you not modifying the readme example implies that Google Tag Manager works just as fine when called from the body and not from the head ?
EDIT: oh, actually, it's being set in the head with document.head.appendChild(script);
Hi.
Google Tag Manger Quick Start Guide said
script
tag should be in a head tag andnoscript
tag should be placed just afterbody
tag.but https://github.com/holidaycheck/react-google-tag-manager#how-to-use looks different with Quick Start Guide said.
Does it need to fix it?