What google script can I keep
Question:
if you have Google tag (gtag.js) do to need to have the old google analytics script and or <!-- Google Tag Manager -->
Answer:
The short answer is no, you generally do not need the old Google Analytics script or the Google Tag Manager (GTM) container code if you are already using gtag.js. In fact, running multiple versions of the same tracking can lead to double-reporting and messy data.
However, the "right" choice depends on how you want to manage your marketing tools. Here is the breakdown of how these three scripts relate to one another.
1. The Script Comparison
| Script Type | Technical Name | Purpose |
| Global Site Tag | gtag.js | The modern, hard-coded way to send data to Google Analytics 4 (GA4) and Google Ads. |
| Google Tag Manager | gtm.js | A "container" that allows you to manage GA4, FB Pixels, and LinkedIn tags without touching website code. |
| Old Analytics | ga.js / analytics.js | The "Universal Analytics" legacy scripts. These are obsolete for GA4. |
2. When to Keep or Remove
- If you use gtag.js
- Remove analytics.js: The old Universal Analytics script is no longer necessary. GA4 is the current standard, and gtag.js is built to handle it.
- Don't add GTM yet: If you have gtag.js hard-coded on your site, adding the GTM snippet as well is redundant unless you plan to move all your tracking into GTM.
- If you want to use Google Tag Manager (GTM)
- Remove gtag.js: If you decide to use GTM, you should move your GA4 measurement ID into a tag inside the GTM dashboard and delete the hard-coded gtag.js from your website's <head>.
- Why? Having both will likely cause your page views to count twice.
3. Which one should you choose?
- Stick with gtag.js if: You have a simple site, you only care about Google products (Analytics and Ads), and you don't mind occasionally editing your website's code.
- Switch to GTM if: You use multiple third-party tags (Facebook, Hotjar, Pinterest) and want to manage them all in one place without needing a developer every time you change a button click event.
- Pro-tip: If you find both gtag.js and GTM code on your site right now, check your "Realtime" report in Google Analytics. If you see two hits every time you refresh the page, you are double-tracking and need to remove one.
4. Samples of the Scripts
Modern GA4 / Google Tag (gtag.js)
Google Tag Manager (GTM)
Universal Analytics (analytics.js)
Classic Google Analytics (ga.js)
Note: Consulting with a Google Tagging Specialist or a Data Analyst is always the safest bet before you start stripping code out of your <head> section, especially if you have complex conversion tracking tied to your revenue.



