{"id":2747,"date":"2007-12-21T19:47:37","date_gmt":"2007-12-21T14:17:37","guid":{"rendered":"https:\/\/www.quickonlinetips.com\/archives\/2007\/12\/update-google-analytics-code-to-gajs-for-better-tracking\/"},"modified":"2026-10-21T15:20:17","modified_gmt":"2026-10-21T09:50:17","slug":"update-google-analytics-code-to-gajs-for-better-tracking","status":"publish","type":"post","link":"https:\/\/www.quickonlinetips.com\/archives\/2007\/12\/update-google-analytics-code-to-gajs-for-better-tracking\/","title":{"rendered":"How to Update Old Google Analytics Code to GA4 (2026 Guide)"},"content":{"rendered":"<p>Still have old ga.js, urchin.js or analytics.js tracking code on your site? Then you&#8217;re not collecting any data. In 2007 we told readers to <strong>update Google Analytics code<\/strong> from urchin.js to the new ga.js. Since then Google has replaced its tracking code several times, and Universal Analytics was shut down completely. Here&#8217;s how to check what you&#8217;re running and switch to Google Analytics 4 (GA4) in 2026.<\/p>\n<p><img decoding=\"async\" class=\"aligncenter size-large wp-image-67815\" src=\"https:\/\/www.quickonlinetips.com\/archives\/wp-content\/uploads\/google-analytics-4-setup-2026.webp\" alt=\"Orange and blue 3D bar chart representing Google Analytics 4 website traffic reports\" width=\"1200\" height=\"630\" srcset=\"https:\/\/www.quickonlinetips.com\/archives\/wp-content\/uploads\/google-analytics-4-setup-2026.webp 1200w, https:\/\/www.quickonlinetips.com\/archives\/wp-content\/uploads\/google-analytics-4-setup-2026-300x158.webp 300w, https:\/\/www.quickonlinetips.com\/archives\/wp-content\/uploads\/google-analytics-4-setup-2026-1024x538.webp 1024w, https:\/\/www.quickonlinetips.com\/archives\/wp-content\/uploads\/google-analytics-4-setup-2026-150x79.webp 150w, https:\/\/www.quickonlinetips.com\/archives\/wp-content\/uploads\/google-analytics-4-setup-2026-768x403.webp 768w\" sizes=\"(max-width: 1200px) 100vw, 1200px\" \/><\/p>\n<p><strong>Quick answer:<\/strong> Old Google Analytics code (urchin.js, ga.js and analytics.js with &#8220;UA-&#8221; IDs) no longer collects data: standard Universal Analytics properties stopped processing hits on July 1, 2023. To update, create a GA4 property in Google Analytics, add a web data stream, and install the Google tag (gtag.js) with your &#8220;G-&#8221; Measurement ID in the head of every page. Then remove the old snippet.<\/p>\n<div id=\"ez-toc-container\" class=\"ez-toc-v2_0_89 counter-hierarchy ez-toc-counter ez-toc-custom ez-toc-container-direction\">\n<p class=\"ez-toc-title\" style=\"cursor:inherit\">Table of Contents<\/p>\n<label for=\"ez-toc-cssicon-toggle-item-6ae1a36aa82f1\" class=\"ez-toc-cssicon-toggle-label\"><span class=\"ez-toc-cssicon\"><span class=\"eztoc-hide\" style=\"display:none;\">Toggle<\/span><span class=\"ez-toc-icon-toggle-span\"><svg style=\"fill: #1a202c;color:#1a202c\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" class=\"list-377408\" width=\"20px\" height=\"20px\" viewBox=\"0 0 24 24\" fill=\"none\"><path d=\"M6 6H4v2h2V6zm14 0H8v2h12V6zM4 11h2v2H4v-2zm16 0H8v2h12v-2zM4 16h2v2H4v-2zm16 0H8v2h12v-2z\" fill=\"currentColor\"><\/path><\/svg><svg style=\"fill: #1a202c;color:#1a202c\" class=\"arrow-unsorted-368013\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"10px\" height=\"10px\" viewBox=\"0 0 24 24\" version=\"1.2\" baseProfile=\"tiny\"><path d=\"M18.2 9.3l-6.2-6.3-6.2 6.3c-.2.2-.3.4-.3.7s.1.5.3.7c.2.2.4.3.7.3h11c.3 0 .5-.1.7-.3.2-.2.3-.5.3-.7s-.1-.5-.3-.7zM5.8 14.7l6.2 6.3 6.2-6.3c.2-.2.3-.5.3-.7s-.1-.5-.3-.7c-.2-.2-.4-.3-.7-.3h-11c-.3 0-.5.1-.7.3-.2.2-.3.5-.3.7s.1.5.3.7z\"\/><\/svg><\/span><\/span><\/label><input type=\"checkbox\"  id=\"ez-toc-cssicon-toggle-item-6ae1a36aa82f1\" checked aria-label=\"Toggle\" \/><nav><ul class='ez-toc-list ez-toc-list-level-1 ' ><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-1\" href=\"https:\/\/www.quickonlinetips.com\/archives\/2007\/12\/update-google-analytics-code-to-gajs-for-better-tracking\/#A_short_history_of_Google_Analytics_tracking_code\" >A short history of Google Analytics tracking code<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-2\" href=\"https:\/\/www.quickonlinetips.com\/archives\/2007\/12\/update-google-analytics-code-to-gajs-for-better-tracking\/#How_to_check_which_Google_Analytics_code_you_have\" >How to check which Google Analytics code you have<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-3\" href=\"https:\/\/www.quickonlinetips.com\/archives\/2007\/12\/update-google-analytics-code-to-gajs-for-better-tracking\/#How_to_update_Google_Analytics_code_to_GA4\" >How to update Google Analytics code to GA4<\/a><ul class='ez-toc-list-level-3' ><li class='ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-4\" href=\"https:\/\/www.quickonlinetips.com\/archives\/2007\/12\/update-google-analytics-code-to-gajs-for-better-tracking\/#Updating_Google_Analytics_in_WordPress\" >Updating Google Analytics in WordPress<\/a><\/li><\/ul><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-5\" href=\"https:\/\/www.quickonlinetips.com\/archives\/2007\/12\/update-google-analytics-code-to-gajs-for-better-tracking\/#Our_2007_update_for_the_record\" >Our 2007 update, for the record<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-6\" href=\"https:\/\/www.quickonlinetips.com\/archives\/2007\/12\/update-google-analytics-code-to-gajs-for-better-tracking\/#FAQ\" >FAQ<\/a><ul class='ez-toc-list-level-3' ><li class='ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-7\" href=\"https:\/\/www.quickonlinetips.com\/archives\/2007\/12\/update-google-analytics-code-to-gajs-for-better-tracking\/#Does_gajs_still_work\" >Does ga.js still work?<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-8\" href=\"https:\/\/www.quickonlinetips.com\/archives\/2007\/12\/update-google-analytics-code-to-gajs-for-better-tracking\/#What_is_the_difference_between_a_UA-_and_a_G-_ID\" >What is the difference between a UA- and a G- ID?<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-9\" href=\"https:\/\/www.quickonlinetips.com\/archives\/2007\/12\/update-google-analytics-code-to-gajs-for-better-tracking\/#Can_I_still_see_my_old_Universal_Analytics_data\" >Can I still see my old Universal Analytics data?<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-10\" href=\"https:\/\/www.quickonlinetips.com\/archives\/2007\/12\/update-google-analytics-code-to-gajs-for-better-tracking\/#Where_do_I_paste_the_GA4_tracking_code\" >Where do I paste the GA4 tracking code?<\/a><\/li><\/ul><\/li><\/ul><\/nav><\/div>\n<h2><span class=\"ez-toc-section\" id=\"A_short_history_of_Google_Analytics_tracking_code\"><\/span>A short history of Google Analytics tracking code<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<ul>\n<li><strong>urchin.js:<\/strong> the original tracking code, based on Urchin software that Google bought before launching Google Analytics.<\/li>\n<li><strong>ga.js:<\/strong> introduced in December 2007 with better ecommerce tracking. That&#8217;s the upgrade this post originally covered.<\/li>\n<li><strong>analytics.js (Universal Analytics):<\/strong> replaced ga.js and used &#8220;UA-&#8221; tracking IDs.<\/li>\n<li><strong>gtag.js and GA4:<\/strong> the current Google tag and Google Analytics 4, which uses &#8220;G-&#8221; Measurement IDs and an event-based data model.<\/li>\n<\/ul>\n<p>According to <a href=\"https:\/\/support.google.com\/analytics\/answer\/11583528\" target=\"_blank\" rel=\"noopener\"><strong>Google&#8217;s Universal Analytics sunset notice<\/strong><\/a>, standard UA properties stopped processing data on July 1, 2023, and access to UA data in the interface and API was removed starting July 1, 2024. Any page still running old code sends data nowhere.<\/p>\n<h2><span class=\"ez-toc-section\" id=\"How_to_check_which_Google_Analytics_code_you_have\"><\/span>How to check which Google Analytics code you have<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<ol>\n<li>Open your site, right-click and choose View Page Source.<\/li>\n<li>Search the source for <code>urchin.js<\/code>, <code>ga.js<\/code>, <code>analytics.js<\/code>, <code>gtag<\/code> and <code>UA-<\/code> or <code>G-<\/code>.<\/li>\n<li>If you only find &#8220;UA-&#8221; IDs or the older scripts, you need to install GA4.<\/li>\n<li>You can also use <a href=\"https:\/\/tagassistant.google.com\/\" target=\"_blank\" rel=\"noopener\"><strong>Google Tag Assistant<\/strong><\/a> to see which Google tags fire on a page.<\/li>\n<\/ol>\n<h2><span class=\"ez-toc-section\" id=\"How_to_update_Google_Analytics_code_to_GA4\"><\/span>How to update Google Analytics code to GA4<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<ol>\n<li><strong>Sign in to Google Analytics<\/strong> at <a href=\"https:\/\/marketingplatform.google.com\/about\/analytics\/\" target=\"_blank\" rel=\"noopener\"><strong>Google Analytics<\/strong><\/a>. New users click Start measuring to create an account.<\/li>\n<li><strong>Create a GA4 property:<\/strong> go to Admin, click Create, then Property. Enter a name, time zone and currency, answer the business questions and click Create.<\/li>\n<li><strong>Add a web data stream:<\/strong> in Admin, open Data streams, click Add stream, choose Web, enter your site URL and create the stream. Leave enhanced measurement on to track scrolls, outbound clicks, site search and more automatically.<\/li>\n<li><strong>Copy your Measurement ID:<\/strong> it starts with &#8220;G-&#8221; and is shown in the stream details.<\/li>\n<li><strong>Install the Google tag:<\/strong> in the stream, click View tag instructions, choose Install manually, and paste the gtag.js snippet into the <code>&lt;head&gt;<\/code> of every page. Many site builders and plugins only need the Measurement ID.<\/li>\n<li><strong>Remove the old code:<\/strong> delete any urchin.js, ga.js or analytics.js snippets so the page stays clean.<\/li>\n<li><strong>Verify:<\/strong> open the Realtime report and visit your site. Data can take up to 30 minutes to appear.<\/li>\n<\/ol>\n<h3><span class=\"ez-toc-section\" id=\"Updating_Google_Analytics_in_WordPress\"><\/span>Updating Google Analytics in WordPress<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<p>The easiest option is Google&#8217;s official <a href=\"https:\/\/sitekit.withgoogle.com\/\" target=\"_blank\" rel=\"noopener\"><strong>Site Kit by Google<\/strong><\/a> plugin, which connects GA4 and adds the tag for you. Alternatively, paste the Measurement ID into your SEO or theme plugin&#8217;s analytics setting, or add the gtag.js snippet to your theme header. Use only one method so pageviews aren&#8217;t counted twice.<\/p>\n<h2><span class=\"ez-toc-section\" id=\"Our_2007_update_for_the_record\"><\/span>Our 2007 update, for the record<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p>Back then, switching from urchin.js to ga.js took about a minute: in the old Analytics interface you clicked Edit next to the website profile, then Check Status, chose the New Tracking Code (ga.js) option and pasted it just before the closing body tag. Google&#8217;s warning from that time still applies today: never run two different versions of the tracking code on the same page, or your reports will be inaccurate.<\/p>\n<p>Once GA4 is running, learn how to <a href=\"https:\/\/www.quickonlinetips.com\/archives\/2011\/03\/how-to-track-more-pageviews-with-google-analytics\/\">track more pageviews with Google Analytics 4<\/a>, how to <a href=\"https:\/\/www.quickonlinetips.com\/archives\/2010\/07\/make-money-online-with-google-analytics\/\">make more money with Google Analytics 4<\/a>, and what replaced the <a href=\"https:\/\/www.quickonlinetips.com\/archives\/2014\/08\/adjusted-bounce-rate-in-universal-google-analytics\/\">adjusted bounce rate<\/a> in GA4.<\/p>\n<h2><span class=\"ez-toc-section\" id=\"FAQ\"><\/span>FAQ<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<h3><span class=\"ez-toc-section\" id=\"Does_gajs_still_work\"><\/span>Does ga.js still work?<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<p>No. ga.js, urchin.js and analytics.js sent data to Universal Analytics, which stopped processing data on July 1, 2023 for standard properties. You need GA4.<\/p>\n<h3><span class=\"ez-toc-section\" id=\"What_is_the_difference_between_a_UA-_and_a_G-_ID\"><\/span>What is the difference between a UA- and a G- ID?<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<p>&#8220;UA-&#8221; tracking IDs belonged to Universal Analytics. &#8220;G-&#8221; Measurement IDs belong to Google Analytics 4 properties, the current version.<\/p>\n<h3><span class=\"ez-toc-section\" id=\"Can_I_still_see_my_old_Universal_Analytics_data\"><\/span>Can I still see my old Universal Analytics data?<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<p>No. Google removed access to Universal Analytics data in the interface and API starting July 1, 2024. If you exported reports before then, keep those files.<\/p>\n<h3><span class=\"ez-toc-section\" id=\"Where_do_I_paste_the_GA4_tracking_code\"><\/span>Where do I paste the GA4 tracking code?<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<p>Paste the Google tag (gtag.js) snippet immediately after the opening <code>&lt;head&gt;<\/code> tag on every page, or use a plugin or Google Tag Manager to add it.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Still have old ga.js, urchin.js or analytics.js tracking code on your site? Then you&#8217;re not collecting any data. In 2007&#8230;<\/p>\n","protected":false},"author":4,"featured_media":67815,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_kad_post_transparent":"","_kad_post_title":"","_kad_post_layout":"","_kad_post_sidebar_id":"","_kad_post_content_style":"","_kad_post_vertical_padding":"","_kad_post_feature":"","_kad_post_feature_position":"","_kad_post_header":false,"_kad_post_footer":false,"_kad_post_classname":"","footnotes":""},"categories":[3],"tags":[],"class_list":["post-2747","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-google"],"_links":{"self":[{"href":"https:\/\/www.quickonlinetips.com\/archives\/wp-json\/wp\/v2\/posts\/2747","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.quickonlinetips.com\/archives\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.quickonlinetips.com\/archives\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.quickonlinetips.com\/archives\/wp-json\/wp\/v2\/users\/4"}],"replies":[{"embeddable":true,"href":"https:\/\/www.quickonlinetips.com\/archives\/wp-json\/wp\/v2\/comments?post=2747"}],"version-history":[{"count":1,"href":"https:\/\/www.quickonlinetips.com\/archives\/wp-json\/wp\/v2\/posts\/2747\/revisions"}],"predecessor-version":[{"id":67818,"href":"https:\/\/www.quickonlinetips.com\/archives\/wp-json\/wp\/v2\/posts\/2747\/revisions\/67818"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.quickonlinetips.com\/archives\/wp-json\/wp\/v2\/media\/67815"}],"wp:attachment":[{"href":"https:\/\/www.quickonlinetips.com\/archives\/wp-json\/wp\/v2\/media?parent=2747"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.quickonlinetips.com\/archives\/wp-json\/wp\/v2\/categories?post=2747"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.quickonlinetips.com\/archives\/wp-json\/wp\/v2\/tags?post=2747"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}