Categories
Development

dangerouslySetInnerHTML in react application not working for including Segment.io tags

I am trying to include Segment.io in my react/NextJS app. I am following the convention set by a previous function that sets Google Analytics const segmentWriteKey = ‘xyz’; export default class CustomDocument extends Document { setGoogleTags = () => { return { __html: ` window.dataLayer = window.dataLayer || []; function gtag(){dataLayer.push(arguments);} gtag(‘js’, new Date()); gtag(‘config’, […]

Categories
Development

dangerouslySetInnerHTML in react application not working for including Segment.io tags

I am trying to include Segment.io in my react/NextJS app. I am following the convention set by a previous function that sets Google Analytics const segmentWriteKey = ‘xyz’; export default class CustomDocument extends Document { setGoogleTags = () => { return { __html: ` window.dataLayer = window.dataLayer || []; function gtag(){dataLayer.push(arguments);} gtag(‘js’, new Date()); gtag(‘config’, […]