Code sorting and comments
// Create the GA () method and load analytics. JS file // A and m are used as parameters to ensure that the following execution does not modify external variables with the same name (function (Win, Doc, O, G, Ga, a, m) {win ['googleanalyticsobject '] = Ga; // exposes the GA object externally. // make sure that only one analytics is executed. JS insert win [Ga] = Win [Ga] | function () {(WIN [Ga]. Q = Win [Ga]. q | []). push (arguments)}, win [Ga]. L = 1 * new date (); // converts the time format to a numeric type // dynamically loads analytics. js a = Doc. createelement (O), M = Doc. getelementsbytagname (o) [0]; // script. async = 1;. src = g; M. parentnode. insertbefore (a, m);}) (window, document, 'script', '// www.google-analytics.com/analytics.js', 'ga ');
A short piece of code is quite informative.
Compressed code
(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‘);
Reference: https://developers.google.com/analytics/devguides/collection/analyticsjs/advanced? Hl = ZH-TW
Use of Google-analytics: parse page introduction code