Update Google Analytics snippet to use Universal Analytics (analytics.js) instead of ga.js
See original GitHub issueThis is probably still open to debate while Google brings analytics.js out of beta but I’ve tried it on a few websites since it’s release and it is pretty amazing in extra info and tools it brings.
It isn’t really pretty (may be we can hack it to reduce it’s footprint).
More Info: https://developers.google.com/analytics/devguides/collection/analyticsjs/
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');
ga('create', 'UA-XXXX-Y');
ga('send', 'pageview');
Issue Analytics
- State:
- Created 10 years ago
- Comments:23 (12 by maintainers)
Top Results From Across the Web
Migrate from analytics.js to gtag.js (Universal Analytics)
This guide walks you through the process of migrating an existing analytics.js Universal Analytics implementation to use gtag.js .
Read more >[UA→GA4] Tips for switching from analytics.js to gtag.js
If you use analytics.js for your current Universal Analytics property, you'll need to add the gtag.js snippet for your new Google Analytics 4...
Read more >GTAG vs Analytics.js . Which one should you use?
In this guide, you will learn the differences of gtag.js vs analytics.js. Which one should you use and should you migrate to gtag.js?...
Read more >A Guide to Google Analytics Snippet Versions from 2005 to ...
Google Analytics – Universal Analytics (gtag.js) ... The latest GA snippet is gtag.js, it is not as flexible as using Google Tag Manager...
Read more >How to Add Google Analytics Tracking to a Website - Chartio
Once you've identified your tracking ID, you'll need to get your tracking code snippet, which can be found on this page as the...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Furthermore according to Wikipedia, Google Analytics is the most popular analytics program in the world.[1]
If Microsoft Windows happens to be the dominant desktop OS, should software only consider that the use case? Or if Internet Explorer happens to be the most popular browser, should we consider IE specific extensions as sensible? etc.
“Being the most popular” does not seem like a convincing argument.
Sure analytics are useful to beginners, but so is stuff like choosing a webhost or domain registrar. Should we throw that in too?
[1] http://en.wikipedia.org/wiki/Google_Analytics#Popularity
Google Universal Analytics is out of beta!