I was wondering if anyone has succeeded in adding Google Analytics to their notebook. I tried this old topic but didn’t manage to make it work, there are no events reaching Google Analytics.
Ideally this should be in Observable’s documentation, and maintained by Observable, since many people need to know if (and how) their work is being used.
I see more entries in window.dataLayer which suggests that GTM was loaded correctly, but no events are being sent.
It looks like a configuration issue to me. Have you tried manually sending a page_view event? Perhaps this thread contains some helpful hints to narrow down the cause.
It’s not that events aren’t coming through - they don’t get sent in the first place, as far as I can tell (you can check via the network tab in your browser’s dev tools).
Your tag manager code runs in a sandboxed iframe, so you may need to investigate what limitations apply there with regard to GA4 and Google Tag Manager.
But events could also not be firing due to a misconfiguration, since the tag manager script encodes your property config.