0

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.

0

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.