This blog has the answer to your question. The code generates site hit reports for the past 30 days. If you review the code given in this blog then I believe it meets your needs.
Report for site hit count in SharePoint
The other alternate is to use an available sandbox solution on MSDN code:
Create Custom hit counter in SharePoint 2010 using Sandbox Solution
To use this MSDN code follow the below steps:
Step 1: Create a Visual Web Part and copy the code inside Page_Load(object sender, EventArgs e) as same as they did inside Render() Method.
Step 2(Optional): Add the following code if you want to record Client IP address with User, Data & URL.
Step 3: Deploy Hit counter using command (Powershell or STSADM) or VS 2010 to this site
Step 4: Create a Custom List, name it as Statistics or Record List also create three or four columns in Statistics list as like as below:
Url - Multiple lines of text
Date - Single line of text
Username - Single line of text
IP - Single line of text
Step: 5: Add this web part on the home page. To count the hit for all pages in site, you have to place the web-part in all master page, so that the web-part code runs on every page where the visitor go and makes the unique entry in Statistics list.