Google Analytics is a Google official analytics tool that is primarily used to help webmasters understand the data on the site and improve the quality of the site.html
The Google Analytics Admin action page, as follows：web
From the above figure we can see that the page is divided into three parts:session
Just now we copy the tracking code to restore, get the next:app
If you are a front-end developer, the above code is so easy to read.async
The above code has done the following four operations:ide
Read the above steps, I do not know if there is any doubt:ui
So, when using the ga () command queue, you do not have to worry about whether the analytics.js library has finished loading.
Send is a built-in command, the function is to Google Analytics to send the corresponding matching information, such as the built-in method pageview here, we use pageview to measure the number of visits to specific pages on the site, so that is why Google Analytics will show the current user.
Tip: Google Analytics contains these build-in method you can use:
When we read the explanation of the Question2, we may have some question, although Google Analytics has some built-in methods and fields, such as pageview and pageview's title, page, etc., but in actual needs, we may need more data, then how to do?
Go check the next chapter.
When we need to add some additional fields, we can configure the required fields in Google Analytics by 'ADMIN → PROPERTY → Custom Definitions' path.
Note: Each of the different custom dimensions and custom metrics in each property can use 20 exponents. Both the custom and custom metrics for the Premier account can use 200 exponents.
For example, we customized 'name' dimensions and 'age' metrics in the correct path.
And we copy them to the index.html of dorie.top, then we visited the www.dorie.top by change the value of 'name' dimensions and 'age' metrics for simulating the real scene.
Then, we can get some real data from Google Analytics for 24 hours later.
It is easy to customize dimensions and metrics, but we need to pay attention to two places:
The range determines which matches will be associated with a custom dimension value. The range is divided into four levels: product , match , session and user :