Google Analytics (Google Analytics) tips for using

Source: Internet
Author: User
Tags add log modify query domain name

Google Analytics (Google Analytics) is Google's free web analytics service, which has been well-received since its inception. Google Analytics is very powerful, as long as you add a piece of code to the site's page, you can provide a rich and detailed chart report. Today, I'll summarize some of the tips for adding code, using urchintracker code in different formats to keep track of special events on the site (such as events that don't produce a comprehensive view, JavaScript events, file downloads, outbound links, and so on). You can also track events that set properties (such as AdSense, full backlinks, and so on). Of course, before reading these tips, read the main contents of the Google Analyst Help Center. (PostScript: Some techniques are not available in the latest version of Google Analytics)

  I. Statistics non-HTML file clicks

Tracking a link in a Web page file can be achieved by adding the onclick attribute to the link <a> tag, as follows:

<a href= "Http://www.williamlong.info/rss.xml" _fcksavedurl= "Http://www.williamlong.info/rss.xml" "onclick=" Javascript:urchintracker ('/rss.xml '); ">

Note that using this property, you must place the analytics trace code in front of the HTML code, preferably below <body>.

  Second, tracking AdWords

Google Analytics has direct support for tracking AdWords, and for detailed steps see "How to Link a Google Analytics (analytics) account to an AdWords account?" ”。

In addition, VDGRAAF also provides a way to manually modify the code, but also to achieve the same function, the modified example is:

_uacct = "**-******-*"; Your urchin code generated by Google Analytics

if (document.referrer)
{
if (document.referrer.indexOf (' Google ')!=-1)
{
var Urlpattern =/(\?&) q= ([^&]*)/;
var amatches = urlpattern.exec (document.referrer);
if (amatches!= null)
{
Urchintracker ('/query/' + amatches[2]);
}
Else
{
Urchintracker ();
}
}
Else
{
Urchintracker ();
}
}
Else
{
Urchintracker ();
}

Then, in content optimization-content effects-content detail, look at the information in directory query, so you can compare it to the "optimize marketing"-"search engine Marketing"-"pay-per-click and Natural Transformation"-google the AdWords data.

  Third, tracking AdSense click

We have previously introduced the AdSense tracking software is only the user clicks recorded, does not have statistical function, if we want to the previous AD click Statistics, then you can directly use Google Analytics to achieve statistical functions.

The general approach to implementation is:

Add the following statement under Google's AdSense ads

<script type= "Text/javascript" >
function log () {
Urchintracker ('/adsense ');
}
var elements2;
Elements2 = document.getElementsByTagName ("iframe");
for (var i = 0; i < elements2.length; i++) {
if (Elements2[i].src.indexof (' googlesyndication.com ') >-1) {
Elements2[i].onfocus = log;
}
}
</script>

After the modified, please do not click Google Ads to test, that will be Google Lock account, we just slowly wait for Google Analytics statistics.

In addition Seobook also introduced a method, the principle is basically similar.

  Four, tracking all points out of the link

Use the following statement to track all point out links.

Window.onload = Setadslinks;

function Setadslinks ()
{
var Links = document.getelementsbytagname (' A ');
for (var i = 0; i < links.length; i++)
{
Links[i].onclick = function () {
Urchintracker (THIS.HREF);

}
}
}

Note that using this code requires that Google Analytics's statistics code be placed at the top of the page, and there is a side effect of this statistic is that if the hyperlinks are very many, these statements will affect the performance of the browser, and even cause "suspended animation" state.

  Display the complete reverse link

When the statistics source, Google Analytics only display domain name information, we can modify the statistical code to achieve Google Analytics display complete Reverse link

_uacct = "**-******-*"; These are the code generated by Google Analytics.

Replace the original code with the following code.
if (document.referrer)
{
Urchintracker (Document.referrer);
}
Else
{
Urchintracker ();
}

  Six, do not modify the code to display a complete reverse link

Google official provides a way to show the full source without modifying the code, is in the "Optimize marketing"-"audience segmentation effect"-"visit the source", select the icon on the left of the source address, point "cross-group effect", and then click "Content" to return the source specific static URL data, This method is used for the source of static addresses, and dynamic addresses (such as search results) will not work with this.



Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.