Google Analytics Installation Guide

The Google Analytics Installation Guide is intended to allow you to quickly set up and configure a successful set of reports for a profile. If you need more detailed information on any topic, please search our Help Center.



Step 1 - Create a Google Analytics accountBack to Top
Note to AdWords users: Google Analytics is able to import and track cost data from Google AdWords if your AdWords and Analytics accounts are linked. Please sign in to your AdWords account and follow the instructions once you've clicked 'Google Analytics' from the Reporting tab.
To create an Analytics account:
  1. Visit http://www.google.com/analytics.
  2. Enter your Google Account email and password and click Sign In. If you don't have a Google Account, click Sign up now to create one.
  3. Click Sign Up.
  4. Enter your Website's URL, making sure to select either http:// or https:// from the drop-down list. Enter a nickname for this account in the Account Name field, then click Continue.
  5. Enter your contact information and click Continue.
  6. Read the Google Analytics Terms of Service. If you agree to these terms, select the Yes checkbox and click Create New Account to continue.
The Tracking Instructions page that appears contains the tracking code that you'll need to paste into each page of your site. We recommend completing some additional steps before pasting this code, however, to ensure that the data you collect is relevant. If you'd prefer to install the tracking code right away, please skip to Step 4 for instructions.
Otherwise, click Continue on the Tracking Instructions page to access your new account.
Step 2 - Configure your profileBack to Top
It's important to configure your profile in order to get the most out of your reports. To access your profile settings:
  1. In the Website Profiles table, find the profile to edit.
  2. Click Edit. The Profile Settings page appears.
  3. Click Edit on the Main Website Profile Information table.
Default page
Setting this to the default (or index) page of your site allows Google Analytics to reconcile log entries for www.example.com and www.example.com/index.html, for example. These are in fact the same page, but are reported as two distinct pages until the Default Page setting has been configured.
Exclude URL Query Parameters
Does your site use dynamic session or user identifiers? You can tell Analytics to ignore these variables and not count them as unique pages. Enter any query parameters to exclude, separated with commas.
E-Commerce Website
To enable e-commerce reporting and the E-Commerce Analysis report set, select Yes. More information on e-commerce reporting is available in Step 10.
Step 3 - Edit the tracking code for custom website setupsBack to Top
The tracking code that is provided to you is designed to work with most site setups. However, there are a few scenarios that require small updates to the tracking code on each of your pages. If any of the following apply to you, follow the instructions to update your code before adding it to your pages.
Learn how to:
  1. Track multiple domains in one profile (eg. a main site as well as a secure store site)
  2. Track more than one subdomain in one profile
  3. Track multiple domain aliases
Step 4 - Add the tracking code to your pagesBack to Top
Add the tracking code to your pages
Google Analytics only tracks pages that contain the Google Analytics tracking code. You'll need to add this code to each page of your site, either manually or through the use of includes or other methods.
To access your tracking code:
  1. Sign in to Google Analytics.
  2. From the Analytics Settings page, find the profile for which you would like to retrieve the tracking code. Please note that tracking code is profile-specific.
  3. From that profile's Settings column, click Edit.
  4. At the top right of the Main Website Profile Information box, click Check Status.
  5. Your tracking code can be copied and pasted from the text box in the Instructions for adding tracking section.
Basic installation - Copy and paste the code segment into the bottom of your content, immediately before the </body> tag of each page you are planning to track. If you use a common include or template, you can enter it there.
    <script type="text/javascript"> var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www."); document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E")); </script> <script type="text/javascript"> try{ var pageTracker = _gat._getTracker("UA-xxxxxx-x"); pageTracker._trackPageview(); } catch(err) {} </script>
You'll need to update the "xxxx-x" in the sample above with your own Google Analytics account number. You can access your personalized tracking code in its entirety by following the instructions in Where can I find my tracking code?
Once you've completed this step, Google Analytics will begin collecting traffic data. You'll be able to see data in your reports within 24 hours.
Database driven sites - Insert the tracking code on your index.php page or equivalent (eg. default.php, index.cfm).
Pages with frames - A web page containing frames will generate multiple pageviews: one for the framing page (containing either a FRAMESET or IFRAME tag within its HTML code), and one for each page shown in a frame. As a result, pageviews may be somewhat inflated. Even if a page on your site only appears as a frame for another page, we still recommend tagging it with the entire tracking code. If a visitor reaches the page through a search engine or a direct link from another site and the page doesn't contain the tracking code, the referral, keyword and/or campaign information from the source will be lost.
Please see How do I interpret the reports for a website that has frames?
Step 5 - Link with your AdWords accountBack to Top
For AdWords advertisers, Google Analytics can currently import cost data from AdWords campaigns. To link your AdWords and Analytics accounts, sign in to your AdWords account and follow the steps provided after you click 'Google Analytics' from the Reporting tab.
Step 6 - Create goals and funnels Back to Top
If your website is designed to drive visitors to a particular page, such as a purchase or email signup page, you can track the number of successful conversions using goals and funnels in Google Analytics.
  • A goal is a website page a visitor reaches once she or he has made a purchase or completed another desired action, such as a registration or download.
  • A funnel represents the path that you expect visitors to take in order to reach the goal. Defining these pages allows you to see how frequently visitors abandon goals (and where they go instead) and the value of the goal.
Each profile can have up to 4 goals, with a defined funnel for each. To set up goals and funnels:
Enter Goal Information:
  1. From the Analytics Settings page, find the profile for which you will be creating goals and click Edit.
  2. Select one of the four goal slots available for that profile and click Edit.
  3. Enter the Goal URL. Reaching this page marks a successful conversion. For example, a registration confirmation page, a checkout complete page, or a thank you page.
  4. Enter the Goal name as it should appear in your Google Analytics account.
  5. Turn the goal On or Off. This selection decides whether Google Analytics should track this conversion goal at this time. Generally, you'll want to set the Active Goal selection to On.
Then, Define a funnel by following these steps:
  1. Enter the URL of the first page of your conversion funnel. This page should be a page that is common to all users working their way towards your Goal. For example, if you are tracking user flow through your checkout pages, do not include a product page as a step in your funnel.
  2. Enter a Name for this step.
  3. If this step is a Required step in the conversion process, select the checkbox to the right of the step. If this checkbox is selected, users reaching your goal page without travelling through this funnel page will not be counted as conversions.
  4. Continue entering goal steps until your funnel has been completely defined. You may enter up to 10 steps, or as few as a single step.
Finally, configure Additional settings by following the steps below:
  1. If the URLs entered above are Case sensitive, select the checkbox.
  2. Enter a Goal value. This is the value used in Google Analytics' ROI calculations, and can be either a set value for the page, or a dynamic value pulled from your e-commerce receipt page. If the former, enter the amount in the field; if the latter, leave this field blank and refer to How do I track e-commerce transactions?
  3. Select a Match Type. There are three different Match Types you may select for your goal: Exact, Head, or Regular Expression.
    - Exact Match: This option requires that the URLs entered as your funnel and goal URLs exactly match the URLs shown in the reports. For example, there can be no dynamic session identifiers or query parameters. Note: If you are using an exact match for a goal (i.e. http://domain.com/page.html), any trailing spaces will cause the goal to be invalid. If you are using partial matching (i.e. ^/page.html), trailing spaces are not an issue.
    - Head Match: If your website has dynamically generated content, use the Head Match filter and leave out the unique values. For example, if the URL for a particular user is http://www.example.com/checkout.cgi?page=1&id=9982251615 but the id varies for every other user, enter http://www.example.com/checkout.cgi?page=1 and select Head Match as your match type.
    - Regular Expression Match: This option uses regular expressions to match your URLs. This is useful when the stem, trailing parameters, or both can vary between users. For example, if a user could be coming from one of many subdomains, and your URLs use session identifiers, use regular expressions to define the constant element of your URL. For example, page=1 will match "http://sports.example.com/checkout.cgi?page=1&id=002" as well as "http://fishing.example.com/checkout.cgi?page=1&language=fr&id119."
  4. Click Save Changes to create this Goal and funnel, or Cancel to exit without saving.
Please see the following articles for more information on setting up goals:
Step 7 - Tag your advertising campaigns Back to Top
Note to AdWords users: If you'll only be tracking AdWords campaigns, you may skip this step. Once you've linked your AdWords and Analytics accounts, AdWords keywords are automatically tagged with the required tracking variables.
Tagging your online ads is an important prerequisite to allowing Google Analytics to show you which marketing activities are really paying off. Tagging involves inserting and defining specific variables into the links that lead to your website.
Generally speaking, you need to tag all of your paid keyword links, your banners and other ads, and the links inside your promotional email messages, except those in Google AdWords, which are automatically tagged. Fortunately, the tagging process goes smoothly once you understand how to differentiate your campaigns. In addition, the URL Builder tool makes it easy to tag your links.
For a full explanation of tagging your links, please read How do I tag my links? If you'd like to get started quickly, refer to the table below.
Variable Name Description
utm_source Source Every referral to a web site has an origin, or source . Examples of sources are the Google search engine, the AOL search engine, the name of a newsletter, or the name of a referring web site.
utm_medium Medium The medium helps to qualify the source; together, the source and medium provide specific information about the origin of a referral. For example, in the case of a Google search engine source, the medium might be "cost-per-click", indicating a sponsored link for which the advertiser paid, or "organic", indicating a link in the unpaid search engine results. In the case of a newsletter source, examples of medium include "email" and "print".
utm_term Term The term or keyword is the word or phrase that a user types into a search engine.
utm_content Content The content dimension describes the version of an advertisement on which a visitor clicked. It is used in content-targeted advertising and Content (A/B) Testing to determine which version of an advertisement is most effective at attracting profitable leads.
utm_campaign Campaign The campaign dimension differentiates product promotions such as "Spring Ski Sale" or slogan campaigns such as "Get Fit For Summer".
An example URL:
http://www.examplesite.com/?utm_source=google&utm_medium=ppc &utm_term=exampleword &utm_content=campaign1 &utm_campaign=exampleproduct
Step 8 - Creating FiltersBack to Top
A filter is used to include, exclude, or change the representation of certain information in a report.
Filters aren't required, but using them will help you define what data you see and how you see it. Since filters affect the way data is displayed in your reports, it is important to get them set up as soon as possible. Filters added after your account begins collecting data will not affect your old data.
You'll want to create filters if:
  • you want to see reports for a certain subdomain or subdirectory only
  • you'd like to exclude traffic from certain people or places
  • your dynamic parameters would be more easily readable as descriptive text strings
There are a number of other reasons that you may want filters, but if none of these apply to you, you can safely skip ahead to the next step.
A filter consists of:
  • The name of the filter
  • The type of filter you would like to implement
  • The filter field that is affected. More information about these fields is available from our Help Center: What information do the filter fields represent?
  • The filter pattern is the string that will be matched against the filter field. This field uses regular expressions, a special syntax that uses wildcards and text strings for matching. Please read What are regular expressions? for instructions and tips.
To create a filter:
  1. Click the Filter Manager link from the Analytics Settings page.
  2. Click Add Filter.
Filter Types
Analytics provides three predefined filters, useful for common tasks, as well as a number of custom filters.
Predefined filters:
  1. Exclude all clicks from a domain (hostname): use this filter to exclude clicks that originate from a specific network, such as your internal work network.
  2. Exclude all clicks from an IP address: this filter works to exclude clicks from certain sources. You can enter a single IP address, or a range of addresses
  3. Include only traffic from a subdirectory: use this filter if you want a profile to report only on a particular subdirectory (such as www.example.com/motorcycles)
Custom filters:
  • Exclude Pattern: This type of filter excludes log file lines (hits) that match the Filter Pattern. Matching lines are ignored in their entirety; for example, a filter that excludes Netscape will also exclude all other information in that log line, such as visitor, path, referral, and domain information.
  • Include Pattern: This type of filter includes log file lines (hits) that match the Filter Pattern. All non-matching hits will be ignored and any data in non-matching hits is unavailable to the Urchin reports.
  • Search & Replace: This is a simple filter that can be used to search for a pattern within a field and replace the found pattern with an alternate form.
  • Lookup Table: Selecting this filter allows you to select a lookup table name which may be used to map codes to human intelligible labels. For example, the phone models table maps abbreviated phone platform identifiers to the model and manufacturer names for phone based web browsers.
  • Advanced: This type of filter allows you to build a field from one or two other fields. The filtering engine will apply the expressions in the two Extract fields to the specified fields and then construct a field using the Constructor expression. Read the Advanced Filters article for more information.
  • Uppercase / Lowercase: Converts the contents of the field into all uppercase or all lowercase characters. These filters only affect letters, and will not affect characters or numbers.
Common uses
Report traffic to a subdomain only - If you have your tracking code on your entire domain, but would like to view reports about a particular subdomain on their own, you can create a filter to include only traffic to your subdomain.
Filter Type: Custom filter > Include
Filter Field: Hostname
Filter Pattern: subdomain\.example\.com
Case Sensitive: No
This will exclude all traffic that is not on the domain subdomain.example.com.
Exclude internal IP addresses - If you'd like to exclude traffic from internal IP addresses, so that your own visits and those of your employees don't show up in your reports, enter your IP address in the filter below. You can also filter out a range of addresses, as in the second example. Remember to use regular expressions in the IP Address field.
Filter Type: Exclude all traffic from an IP address
IP Address: 99\.999\.999\.9
Or, to filter a range of 192.168.1.1 to 192.168.125:
Filter Type: Exclude all traffic from an IP address
IP Address: ^192\.168\.1\.([1-9]|[1-9][0-9 ]|1[01][0-9]|12[0-5])$
Step 9 - Grant access to other users Back to Top
Google Analytics provides the ability to add any number of users to your account, and to grant varying levels of access to your reports..
Granting profile access
To allow access to another user, follow the instructions below. Please note that additional users will need to create a free Google Account in order to be granted access.
  1. Click User Manager.
  2. Click Add.
  3. Enter the user's email address, last name, and first name.
  4. Select the User Type for this user: View reports only, or Account Administrator, which allows the user to edit account settings.
  5. If you selected View reports only, select the profiles to which this user should have access (note that Account Admins have access to all profiles). Reports for profiles that are not selected will not be available to this user.
  6. Click Add to move these profiles into the Selected Website Profiles list.
  7. Click Finish to create the new user.
Step 10 - Enable e-commerce transaction trackingBack to Top
With some simple additions to your receipt page, Google Analytics can automatically detect and record transaction and product information. The required information is placed into a hidden form which is parsed for transaction and product information. Most template driven e-commerce systems can be modified to include this information in the receipt.
You'll also need to enable e-commerce reporting for your website's profile:
  • From the Analytics Settings page, click Edit next to the profile you would like to enable.
  • Click Edit from the Main Website Profile Information box
  • Change the E-commerce Website radio button from No to Yes.
Writing the required information
Somewhere in the receipt, below the tracking code, the following lines need to be written by your engine. Everything in brackets should be replaced by actual values, as described in How do I track e-commerce transactions?
    <script type="text/javascript"> var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www."); document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E")); </script> <script type="text/javascript"> try { var pageTracker = _gat._getTracker("UA-xxxxxx-x"); ; pageTracker._addTrans( "1234", // Order ID "Mountain View", // Affiliation "11.99", // Total "1.29", // Tax "5", // Shipping "San Jose", // City "California", // State "USA" // Country ); pageTracker._addItem( "1234", // Order ID "DD44", // SKU "T-Shirt", // Product Name "Green Medium", // Category "11.99", // Price "1" // Quantity ); pageTracker._trackTrans(); } catch(err) {} </script>
Refer to How do I track e-commerce transactions? for further instructions on writing transaction information to your receipt pages.
More information
Tracking transactions across domains and subdomains - If you are tracking transactions that occur on a different domain or subdomain than your main site, read How do I use Google Analytics to track a 3rd-party shopping cart? for instructions on updating your tracking code.
3rd party shopping cart compatability - Google Analytics uses 1st party cookie technology to track visitors and generate reports. 1st party cookies require that the JavaScript code be called from each web page to avoid breaching the security settings in your visitors' web browsers. If you can edit the source code of your shopping cart site and add the Google Analytics tracking code, you'll be able to use it with Google Analytics.


0 nhận xét:

Post a Comment