Quick answer: A Universal Analytics upgrade has two parts. First, the property is transferred to Universal Analytics in the Admin area (Google has already done this automatically for many accounts). Second, you replace the old ga.js or dc.js tracking code on your site with the analytics.js code, and rewrite any custom event, ecommerce or custom variable tracking in the new syntax. Your historical data stays in place. The work is mostly in auditing what your old code tracked and rebuilding it properly.
Universal Analytics has been out of beta since April 2014 and is now the standard version of Google Analytics. New features are built for it, and the classic code is on the way out. If your site still loads ga.js, it still collects data, but you are missing features and building up a job that will only get harder to put off.
How to tell which version you have
View the source of any page on your site and search for these:
- ga.js or
_gaq.push: classic Google Analytics. - dc.js: classic Google Analytics with display advertising features.
- analytics.js or
ga('create': Universal Analytics. - gtm.js: Google Tag Manager. Open your container to see which tag types it uses. A “Classic Google Analytics” tag means you still need to upgrade.
In the Admin area you can also open Tracking Info, then Tracking Code, in the property column to see the tracking code Google expects you to use for that property.
What you get from Universal Analytics
- Custom dimensions and metrics. These replace custom variables, with more slots (20 of each on the free version) and more flexibility.
- Settings in the Admin area rather than in code. Session timeout, campaign timeout, organic search sources, referral exclusions and search term exclusions can all be changed without touching the site.
- User ID. Lets you connect sessions across devices for logged in users, if you set it up and follow the policy.
- Measurement Protocol. Send data to Analytics from other systems, such as a till, a CRM or a booking system, not just from web pages.
- Enhanced Ecommerce. Far more detail on product views, cart actions, checkout steps and promotions than the classic ecommerce reports.
- Simpler cookies. One first party
_gacookie instead of the classic set of__utma,__utmb,__utmzand friends.
The upgrade, step by step
Step 1: Audit your current tracking
Before changing anything, write down everything your current setup does. Check for:
- The main tracking snippet and where it lives (theme header, a plugin, Tag Manager).
- Event tracking on buttons, downloads, outbound links and video plays.
- Virtual pageviews, for example on form thank you steps.
- Ecommerce tracking on the order confirmation page.
- Custom variables.
- Cross domain tracking, for example to a separate booking or payment domain.
- Filters and goals in each view that depend on any of the above.
This list becomes your test plan.
Step 2: Transfer the property
In Admin, open the property column and look for Universal Analytics Upgrade. If you see a prompt to transfer, follow it. If the option is missing or says the transfer is complete, Google has already moved the property for you. Either way, your history, views, goals and filters stay where they are.
After transfer, the property can process both old and new tracking code, which gives you a window to switch the code over.
Step 3: Review the new admin settings
Go through the property settings that used to live in code:
- Session and campaign timeout under Tracking Info, Session Settings.
- Organic search sources if you added custom search engines in the old code.
- Referral exclusion list. Add your own domain and any payment provider such as PayPal, so customers returning from checkout are not counted as new referral visits.
- Search term exclusion list for branded terms, if you used that before.
Step 4: Replace the tracking code
Replace the ga.js snippet with the analytics.js snippet from Tracking Info, Tracking Code. Make sure the old code is removed completely. Running both on the same page with the same property ID will double count.
On WordPress, check where the code was added. It is often in header.php, a theme options box, or a plugin such as Google Analytics by Yoast. Update the plugin settings to use Universal tracking, or remove the plugin if the code now lives in Tag Manager.
Step 5: Rewrite events and custom tracking
The syntax is different, so every custom call needs rewriting.
Events. Classic:
_gaq.push(['_trackEvent', 'Downloads', 'PDF', 'Price list']);
Universal:
ga('send', 'event', 'Downloads', 'PDF', 'Price list');
Virtual pageviews. Classic _gaq.push(['_trackPageview', '/thank-you/']) becomes ga('send', 'pageview', '/thank-you/').
Custom variables. Create custom dimensions under Admin, Custom Definitions, then send them with your pageview, for example ga('set', 'dimension1', 'Member');.
Ecommerce. Load the ecommerce plugin with ga('require', 'ecommerce') and use the new transaction and item calls. If you have time, consider Enhanced Ecommerce instead, which uses the ec plugin and gives much better reports. Many shopping cart platforms and WooCommerce extensions already support it.
Display features. If you used dc.js for remarketing or demographics reports, add ga('require', 'displayfeatures'); and turn on the features in Admin.
Cross domain tracking. Use the linker plugin with ga('require', 'linker') and list the domains with autoLink. Set allowLinker to true when creating the tracker on each domain.
Step 6: Consider Google Tag Manager
If you are rewriting all your tracking anyway, it can be a good moment to move it into Google Tag Manager. You add one container snippet to the site, then manage the Universal Analytics tag, events and other scripts in Tag Manager. Changes become quicker, and you can preview them before publishing.
Step 7: Test before and after
- Use the Real Time reports to confirm pageviews and events arrive.
- Use the Google Tag Assistant extension in Chrome to check the code fires once per page.
- Place a test order and confirm the transaction appears.
- Compare the week after the switch with the week before. Large swings in sessions or bounce rate usually mean double tracking or a missing snippet on some templates.
Annotate the change
Add an annotation on the date you switched code. When someone looks at the reports in a year and sees a shift in bounce rate or referrals, they will know why.
Common mistakes
- Leaving the old code on some pages. Templates such as landing pages, blogs on a sub domain, or checkout pages are often missed.
- Forgetting the referral exclusion list. Payment gateways then show up as your top referrer.
- Not rebuilding goals that depended on events. If event categories or labels changed, update the goal settings to match.
- Breaking filters. Filters that relied on custom variables need updating to use custom dimensions.
- Ignoring spam. Ghost referral spam has become a real problem in many accounts. Our guide to referral spam shows how to filter it so the upgraded data is clean.
FAQ
Will I lose my historical data?
No. Data stays in the property and views. Only the code that sends new data changes.
Can I run classic and Universal code at the same time?
Only if they send to different property IDs, which some teams do briefly for testing. Never run both against the same property.
Do I need a developer?
For a simple brochure site with no events, swapping the snippet is quick. If you have ecommerce, events or cross domain tracking, it is worth having someone experienced audit and rebuild it.
What should I do after upgrading?
Link your property to Search Console if you have not already. Our guide on how to link Search Console to Google Analytics takes about five minutes.
Want your tracking set up properly?
We audit and rebuild Analytics setups so the numbers can be trusted, then turn them into reports you can act on. See how we help you know what’s working.