If you have gone through the trouble of setting up a public site for SharePoint Online, you will probably want...
to gather data about who visits the site. SharePoint 2013 analytics offers new ways to gather insight on your site's audience, allowing you to tailor content more effectively, fight sprawl and get more value from your site -- but only if you set up SharePoint to gather the right data.
For more on SharePoint 2013
Lessons learned from a SharePoint migration
There are various ways to check the number of page views that the site receives, but page-view data alone has limited business value. SharePoint 2013 analytics can provide more helpful information, such as a site visitor's geographic location or how the visitor found the page.
One way to accomplish this is to use a Web analytics engine. Microsoft offers a free app for SharePoint called the Web Analytics Integration App, which allows you to link your public-facing SharePoint Online site to the Web analytics engine of your choice. Two of the most commonly used engines are Webtrends and Google Analytics.
You can install the Web Analytics Integration app by logging in with administrative credentials, then visiting a page on your public SharePoint Online site. After doing so, click on Settings and choose the Add an App option. Now go to the SharePoint Store and click on the Public-facing Websites category. Finally, click on the Web Analytics Integration option, then click on Add It, as shown in Figure 1. After you do so, you might be prompted to enter the credentials for your Microsoft account (not your Office 365 account credentials). After entering your credentials, click on the Return to Site button, then the Trust It button.
Once the Web Analytics Integration app has been installed, you need to enable it. From your public-facing website, click on Settings, then on Site Contents, then on the Web Analytics Integration app. When you do, you will be taken to the configuration screen for the app. What you do next depends on which analysis engine you want to use. For the sake of this demonstration, I will walk you through the process of linking your public SharePoint site to Google Analytics.
The first step is to open another browser window, log into Google, then go to the Google Analytics page. As you can see in Figure 2, there are only a few steps involved in setting up Google Analytics.
The first step in the process is to sign up for Google Analytics. Google makes this step painless. Provide an account name and the URL for the site that you want to analyze, as shown in Figure 3. The account name can be anything, but Google recommends using a name that can represent all of your sites, such as a company name. Take a moment to review the privacy options, then complete the account creation process. When you do, Google will provide you with a block of code that you can use to analyze page traffic.
Now, switch back over to SharePoint and paste this block of code into the Head script, Begin body script or End body script section, as shown in Figure 4. In most cases all the positions will work equally well. Finally, click Enable to complete the process.
While the process of connecting SharePoint to a Web analytics engine is simple, there are other considerations concerning the choice of a specific engine. For example, each one delivers slightly different reporting data, so review your options before committing to a particular engine.