Learn business growth with Google Analytics 4 Forums Google Analytics 4 Implementing Google Analytics 4 within a Chrome Extension using Manifest V3 Reply To: Implementing Google Analytics 4 within a Chrome Extension using Manifest V3

  • John

    Member
    15 June 2023 at 11:51 am

    In simple terms, when you’re working with a Chrome extension – in background scripts or content scripts or inside a new HTML page or a pop-up HTML – you can’t directly import scripts from links. This might sound tricky, but there’s a way around it. Instead of pulling scripts directly from a website, you need to bring those scripts into your own extension file and access them from there. So if you were to use Google Analytics, for example, you couldn’t link straight to their site. That won’t work in the context of a Chrome extension. What you’d need to do is create your own versions of those scripts (or find some way to bring them into your directory), name them something like googleAnalytics.js and googleAnalyticsStarter.js, then reference those within your own files. This way, you’re not relying on the direct link to their site, you’re using your local copies of those scripts.