Hi Amitri!
Yes, it’s possible! Here’s an example of what you’d put in your custom component. Make sure to put the custom component on an entity in your scene.
add: (world, component) => {
const analytics = document.createElement('script')
analytics.setAttribute('async')
analytics.src = 'https://www.googletagmanager.com/gtag/js?id=TAG_ID'
analytics.addEventListener('load', () => {
window.dataLayer = window.dataLayer || [];
function gtag() {
dataLayer.push(arguments);
}
gtag('js', new Date());
gtag('config', 'TAG_ID');
})
})
document.head.appendChild(analytics)
}