Configuring Web Analytics – the 2010 way

With SharePoint 2013, the web analytics service application is deprecated and removed; since, it is integrated into the new super power that is SharePoint Search.  This means, learn powershell!  To administer search in 2013 you’ll need to learn about Get-SPEnterpriseSearchServiceApplication, Get-SPEnterpriseSearchTopology, and their cousins.

If you’re still administrating a SharePoint 2010 Farm, here is a link to the official guidance on how to spin up the Web analytics Service application:  http://technet.microsoft.com/en-us/library/gg266382(v=office.14).aspx

A few things to watch out for when doing it through the Central Admin console (e.g. not through the Management Shell):

  • Make sure to specify database names
  • Make sure to use the Default SharePoint Services App Pool so as not to create an uneeded application pool
  • Make sure to use your service application account as the managed account to run the service app and pool under

A few things to watch out for if using this script below:

  • Make sure that the application pool listed for the $appPoolName variable actually exists, or be prepared for it to get created
  • Make sure that the account, servername, etc are all correct for your environment and that the managed service account is present in your farm.
################################################################################################################################

##This script was modified from the script replicates most of the functionality found in the SharePoint Products Configuration##

## Wizard and was adapted from the script at this link ##

## http://technet.microsoft.com/en-us/library/gg983005%28v=office.14%29.aspx ##

################################################################################################################################

Add-PSSnapin Microsoft.SharePoint.PowerShell -erroraction SilentlyContinue

Remove-PSSnapin Microsoft.SharePoint.PowerShell -erroraction SilentlyContinue

Add-PSSnapin Microsoft.SharePoint.PowerShell -erroraction SilentlyContinue

## Settings you may want to change ##

$databaseServerName = "SharePointAlias or Servername, not FQDN"

$saAppPoolName = "Default SharePoint Service App Pool" ##Note this script will create this application pool if it does not exist and will run it with the appPoolUserName

$appPoolUserName = "BeaversOil\spdev14svcapps" # not the farm admin account for Timer and Central admin, although you should check that both services are running under the farm admin account before

# running this script

## WA Service Application Service Names ##

$WebAnalyticsSAName = "Web Analytics Service"


$saAppPool = Get-SPServiceApplicationPool -Identity $saAppPoolName -EA 0

if($saAppPool -eq $null)

{

Write-Host "Creating Service Application Pool…"

$appPoolAccount = Get-SPManagedAccount -Identity $appPoolUserName -EA 0

if($appPoolAccount -eq $null)

{

Write-Host "Please supply the password for the Service Account…"

$appPoolCred = Get-Credential $appPoolUserName

$appPoolAccount = New-SPManagedAccount -Credential $appPoolCred -EA 0

}

$appPoolAccount = Get-SPManagedAccount -Identity $appPoolUserName -EA 0

if($appPoolAccount -eq $null)

{

Write-Host "Cannot create or find the managed account $appPoolUserName, please ensure the account exists."

Exit -1

}

New-SPServiceApplicationPool -Name $saAppPoolName -Account $appPoolAccount -EA 0 > $null

}

Write-Host "Creating Web Analytics Service and Proxy..."

$stagerSubscription = "<StagingDatabases><StagingDatabase ServerName='$databaseServerName' DatabaseName='StagerDB'/></StagingDatabases>"

$reportingSubscription = "<ReportingDatabases><ReportingDatabase ServerName='$databaseServerName' DatabaseName='WarehouseDB'/></ReportingDatabases>"

New-SPWebAnalyticsServiceApplication -Name $WebAnalyticsSAName -ApplicationPool $saAppPoolName -ReportingDataRetention 20 -SamplingRate 100 -ListOfReportingDatabases $reportingSubscription -ListOfStagingDatabases $stagerSubscription > $null

New-SPWebAnalyticsServiceApplicationProxy -Name "$WebAnalyticsSAName Proxy" -ServiceApplication $WebAnalyticsSAName > $null

Get-SPServiceInstance | where-object {$_.TypeName -eq "Web Analytics Web Service"} | Start-SPServiceInstance > $null

Get-SPServiceInstance | where-object {$_.TypeName -eq "Web Analytics Data Processing Service"} | Start-SPServiceInstance > $null


Write-Host "SharePoint Web Analytics Applications installed," -ForegroundColor Yellow

Write-Host "Run additional scripts to create HNSC or close window, your choice, Have a Great Day… " -ForegroundColor Green

############################################## End Script

 

 

 

 

 

Now just make sure that the service is started from the services on server page and then go into monitoring and test the anaytics,

Cheers,