What is the better implementation of Google Analytics for page speed?
We use both Google Analytics and Google Tag Manager, would it be quicker to
- Hard code both
- Run GA through GTM
Webmasters Stack Exchange is a question and answer site for pro webmasters. It only takes a minute to sign up.Sign up to join this community
If you have GTM, you should use it instead of also hard-coding you GA tag. That's what your GTM is for - placing all your tags into one container and managing them all in one place. There's really no sense to have a GTM container loading on your pages and also to maintain a GA tag in the code.
Not only does GTM consolidate all your tags into one container, which is the only tag script that needs to load on your pages, but the tags within load asynchronously in most cases. That translates to faster load times.
That said, GA is a pretty lightweight tag, and UA tags load asynchronously by default. If you're heavily modifying your tag to include various integrations and additional logic, it may load more slowly. Still, with your GTM implemented, there's really no reason to do that. You won't win any milliseconds for sure, and may lose some.