There has been a small regret since I opened my blog in the garden, that is, I don't know the traffic of my blog. Just as a student does not know his or her own exam scores, he or she does not know his or her current scores. I have worked so hard to write my blog, but I don't know my blog traffic. I feel a little sorry.
After searching, we found that Goole has provided such an excellent product as Google Analytics, which can provide traffic statistics for various websites and has been widely used by webmasters. Google is truly a world-class player, they can fully understand the sufferings of common people and save their lives.
I will introduce how to use Google Analytics to perform traffic statistics on blogs in the blog community.
Register a Google account
I think this should not be a problem. There should be very few Internet users who do not have a Google account now. If so, I would say "you're too out ".
Register Google Analytics
Visit https://www.google.com/analyticsto register Google Analytics. You can set the Google Analytics account name and URL. The Google Analytics account name can be set according to your preferences. The website is your blog address.
For example, I set www.cnblogs.com/glorey/
Then, the registration is successful.
Note:During the registration process, Google will provide a code snippet for us to place in every page of our website, but we can modify this code. It will be mentioned later.
A Google Analytics account can track traffic statistics for multiple sites, Google Analytics generates an ID for each account, for example, my account ID is a UA-17045472.
When an account is used to track multiple websites, an ID is generated for each website. The naming method is simple, that is, the account ID is followed by a number, represents the first website tracked under the current account, for example, the first website id I tracked is the UA-17045472-1, the second is the UA-17045472-2, and so on.
Modify blog settings
Next, you need to modify the configuration of the blog garden. Enter the blog garden, personal space, select Configuration, enter the blog configuration tag, and add it in the header HTML code.
<SCRIPT type = "text/JavaScript">
VaR _ gaq = _ gaq | [];
_ Gaq. Push (['_ setaccount', 'ua-*********-*']);
_ Gaq. Push (['_ addorganic', 'baidu', 'word']);
_ Gaq. Push (['_ addorganic', 'soso', 'w']);
_ Gaq. Push (['_ addorganic', 'yoda', 'q']);
_ Gaq. Push (['_ addorganic', 'sogou', 'query']);
_ Gaq. Push (['_ trackpageview', '']);
(Function (){
VaR GA = Document. createelement ('script ');
Ga. src = ('https: '= Document. Location. Protocol? 'Https: // SSL ': 'http: // www') + '.google-analytics.com/ga.js ';
Ga. setattribute ('async', 'true ');
Document.doc umentelement. firstchild. appendchild (GA );
})();
</SCRIPT>
The * part can be adjusted according to the personal website ID. Thanks to the blog Park, I have provided such a good function. I have been exploring csdn for a long time and haven't found out how to add JavaScript to the blog. It's still more user-friendly.
You may have some questions about why the above code is used instead of the default code provided by Google.
In fact, the code snippets provided by Google are a default script, which can be modified as needed. Someone will ask
_ Gaq. Push (['_ addorganic', 'baidu', 'word']);
What does this mean, because Google provides users with the "Access source" function to provide users with access source information for visitors, a large part of which comes through the search engine, however, the default search engine list provided by Google Analytics does not contain popular Chinese search engines, or even Baidu.
However, Google Analytics provides users with the method of manually adding search engines,
_ Gaq. Push (['_ addorganic', 'baidu', 'word']);
With this sentence, Google Analytics can analyze the search engine from which our blog is redirected, and what is the search keyword, this provides us with a better analysis of the visitor's source.
Effect
After talking for a long time, let's see how it works.
DashboardIt contains some of the most common analysis charts, which can be customized, a bit similar to Google's personalized homepage. We can place charts that we think are frequently watched on the page.
VisitorsContains the visitor information, as well as the map-overlay function, which is good. Haha, You can intuitively see the geographical distribution of visitors.
Traffic sourcesThat is the source of access. I am AN ANONYMOUS hacker. The traffic depends on the search engine. Google and Baidu are available in sources. Haha, it seems that manual Addition to the search engine has taken effect.
ContentIncluding website page access analysis, we can see which pages are most accessed by users and which are popular.
Of course, Google Analytics also has many good functions that need to be explored in use.