I have a website that gets embedded in any other website. In my iframe I want to load the gtag for tracking. I am loading the gtag script in following way
<Script
id="google_tag_manager_init"
dangerouslySetInnerHTML={{
__html: `
window.dataLayer = window.dataLayer || [];
function gtag(){window.dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', '${trackerId}');
window.gtag = gtag;`,
}}
/>
<Script async id="google_tag_manager" src={`//www.googletagmanager.com/gtag/js?id=${trackerId}`} />
Now this is working fine on standalone website but not working if this site gets iframed in other site and third party cookies are blocked.