Google Analytics is a service offered by Google that generates detailed statistics about a website’s traffic and traffic sources, and can be configured to measure product conversion rate and sales. Google Analytics is used by many professionals, including marketers, webmasters and technologists. It is currently the most widely used website statistics service. Usage of the basic Google Analytic Services is currently free – making it an excellent tool to implement as part of your strategic plan.
From my perspective as an application development consultant at SCS, the ability to easily integrate Google Analytics with Microsoft ASP.NET websites is especially productive. In this blog, I’ll share a how-to guide for getting started with Google Analytics.
Implementing Google Analytics on an ASP.NET website
The process of integrating Google Analytics with your Microsoft ASP.NET website is fairly straightforward. The following sections detail the specific steps required:
1. Create a Google Account
In order to use Google Analytics, you’ll need to create a Google account (if you don’t already have one). Clicking this link will direct you to where you can create your Google Account.
You will be required to provide a name, email address and password. You will also need to verify your email address before the account is officially created.
2. Respond to the Google Account Verification Email and Log on to Google
Click on the link provided in your Google Account Verification Email to complete the signup process.
Log on to Google with the username and the password that you defined when creating your Google Account.
3. Sign up for Google Analytics
After successfully logging into your Google Account using the link from your Google Account Verification Email, you will be forwarded to a page to start the Google Analytics signup process. Click the “Signup” button.
You’ll land on a page with the option to select “Website” or “Mobile Application.” Choose “Website.” Then you’ll be presented with two choices: “Universal Analytics” or “Classic.” Universal Analytics is currently in Beta and is missing a few features, so the common recommendation is to choose “Classic.”
You will also be asked to provide the following information on this page:
• Account Name
• Website Name
• Website URL
• Industry Category
• Data Sharing
After the above information has been added, click the “Get Tracking ID” button at the bottom of the page.
You will be presented with the Google Terms of Service. Accepting the Terms of Service will launch you into your “Admin” page.
4. Google Analytics Site Configuration
From your site admin page, you’ll be given the opportunity to configure website tracking, including:
• Top Level Domains
• Display Advertiser Support
• Custom Campaign Tags
The website author cuts and pastes this information into the ASP.NET MVC’s shared View page, usually _Layout.cshtml.
Embedding Google Analytics Tracking code into an ASP.NET MVC Website
To track information about all website users, the above tracking code is placed into your top level _Layout.cshtml page as follows. The code must be placed in the “Head” section of the page in order to function correctly. To minimize the complexity of the _Layout.cshtml page, I recommend that you use a partial page to encapsulate the Google Analytics Tracking Code.
If configured correctly, the code will fire every time users browse the site, view a new webpage within the site or refresh their current page within the site.
Basic Measurements Provided by Google Analytics
The following is a listing of key measurements that are provided out of the box with Google Analytics:
• Visitor Demographics – Age, Sex
• Geo – Language, Location
• Behavior – New vs. Returning, Frequency & Recency, Engagement
• Technology – Browser & OS, Network
• Mobile – Desktop/Tablet, Mobile Devices
• Custom Variables – Sky’s the Limit, User Defined
• Visitors Flow – Flow of Visitors through Site
The website author may also add Custom and User Defined variables to add more information regarding a user’s website experience and to track things like sales conversion rates.
The following figure shows information from Google Analytics, illustrating which browser the user was using when accessing the website.
Now that you’ve set up your Google Analytics account within your ASP.NET MVC Website, you’ll be armed with significant new data to help you with critical business decisions.