Learn business growth with Google Analytics 4 Forums Google Analytics 4 Installing GA4 alongside legacy analytics.js without an extra script?

  • Installing GA4 alongside legacy analytics.js without an extra script?

    Posted by Ezra on 8 December 2022 at 7:41 pm

    Hey there! I’ve got a website that’s already using GA (universal analytics) via analytics.js. Now, I’m looking to bring GA4 into the mix, but I’m a bit concerned about page load times, and I’m not too keen on adding another script snippet. Is there a way I can keep things tidy with just one snippet for both Universal Analytics and GA4? Cheers for any help you can offer!

    Alexander replied 1 year, 4 months ago 3 Members · 2 Replies
  • 2 Replies
  • Sophia

    Member
    21 February 2023 at 9:29 pm

    Hey there! So, you’re worried that adding more scripts (like the one for GA4) could slow down your page? No need to stress about it, it’s a common misconception. The reality is, these small, non-blocking scripts like gtag usually don’t really affect your page load time in a noticeable way when loaded asynchronously.

    Now, if you’re into keeping things neat, you might want to look into using something like Google Tag Manager or another tag management system. They’re designed to handle this kind of stuff, only loading scripts as they’re needed. It’s kind of like having one ring to rule them all, without the whole destroy-the-world thing.

    And, just a little food for thought, if loading scripts is a big concern, have you considered not loading the analytics.js at all? You could include everything directly in your source or even rewrite everything to send data directly through the measurement protocol. This would apply to GA4 as well. All these libraries do is make the process of sending network requests to their endpoint easier to manage. Just a thought!

  • Alexander

    Member
    30 June 2023 at 7:20 pm

    Yes, with Google’s new gtag.js you can incorporate both Universal Analytics and GA4 within a single script snippet. Google’s global site tag (gtag.js) is designed to be a unified tracking system which simplifies the process of sending data to different Google tools such as Google Analytics (Universal and GA4), Google Ads, and Google Marketing Platform products. You’ll just need to configure it properly to ensure it sends the correct data to both your Universal Analytics property and your GA4 property. However, do keep in mind that even though this process requires only one script, it does not necessarily mean that your page load times will improve. You are essentially still running two analytics programs, they’re just contained within a single script.

Log in to reply.