Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

I wanna create web part that shows all of the report since Sharepoint Web Analytics start to work.
But as far as i know, i have one choice and its SPWeb.GetUsageData() method and this method only return the last 30 days of reports.
I know Sharepoint itself has a webpart for this but i want more info which is not in the web part.

share|improve this question
    
Please confirm that you are getting results from SPWeb.GetUsageData(); as in my environment it is returning a null datatable. I can see that usage timer jobs are running on my SP 2010 environment. –  user14933 Feb 15 '13 at 11:05

3 Answers 3

To capture usage data from a longer time period, you have to modify the settings of your "Web Analytics Service Application". You can find the settings in your service application management, select the application and click "Properties" in the ribbon. You can define a data retention period from one month to 25 month.

share|improve this answer
1  
thanks. if i do that how it's gonna affect on this method or some other programmatically way to get more than 30 days? –  Jalali Shakib Jul 20 '11 at 3:46
    
To get all usage data, you can use the GetUsageBlob Method using RPC calls. It's a bit ugly, but I don't have a better answer. –  Robert Jul 20 '11 at 16:59

Change the retention period with following command:

Set-SPUsageDefinition -Identity "Page Requests" -DaysRetained 31
share|improve this answer
    
thanks. if i do that how it's gonna affect on this method or some other programmatically way to get more than 30 days? –  Jalali Shakib Jul 20 '11 at 3:48
    
Well you can retrieve for more than 30 days if you configure share point to retain for kore than 30 days.. –  Ashish Patel Jul 20 '11 at 12:19
    
in the SPWeb.GetUsageData() method i have two choice for date, one is "day" and the other "lastMonth", and it's obvious that it will return for the last 30 days of reports. but thanks anyway i figure it out. –  Jalali Shakib Jul 21 '11 at 16:42
up vote 0 down vote accepted

The only way that i came upon with is to reach the data directly from the Analytics Database of the SharePoint and do just reading from "WATrafficAggregationByDate" table.

share|improve this answer
1  
if anyone wanna know all sort of things that i did just comment me. –  Jalali Shakib Jul 25 '11 at 10:11

Your Answer

 
discard

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.