SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Does anyone know how to provision web analytics via visual studio 2010 ?

I have got web analytics working for search results - ie: it will show me how many searches have been performed, top search phrases etc. Its great that its working, but now i need to ensure i can get it working via visual studio.

Any one have any ideas where i start?

Many thanks


share|improve this question
Web Analytics is a Service Application. Sure, it's possibly to programmatically create a Service Application instance from a Farm-scoped Feature Receiver, is this what you want to do? – James Love Aug 11 '11 at 9:48
You should also consider if programmatically configuring this functionality is best or if you can create a powershell script for this one off task? – Dave Hunter Aug 11 '11 at 11:15

You should use PowerShell for provisioning your service apps. For once, you do not always know where your SA's will end up depending on farm topology (dedicated application server etc), so automated farm configuration should be done in PowerShell.

An example (taken from Todd Carter's blog, but there are several examples out there)

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 
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.