Skip to content

Commit d28257f

Browse files
committed
Chart on pageviews changes (if less than 60 days show items for each day, otherwise it shows views for months instead)
1 parent 6bd49cd commit d28257f

File tree

11 files changed

+228
-30
lines changed

11 files changed

+228
-30
lines changed

Analytics.Site/App_Data/Logs/UmbracoTraceLog.txt

Lines changed: 190 additions & 0 deletions
Large diffs are not rendered by default.

Analytics.Site/App_Data/Umbraco.sdf

0 Bytes
Binary file not shown.
Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1 @@
1-
{
2-
"Id": "4113171",
3-
"Name": "www.nibble.be",
4-
"Created": "2008-04-13T14:26:12+02:00",
5-
"Updated": "2011-07-20T00:58:59.981+02:00"
6-
}
1+


Analytics.Site/App_Plugins/Analytics/backOffice/AnalyticsTree/controllers/PageViews.Controller.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212

1313
$scope.$watch('dateFilter', function () {
1414

15-
15+
settingsResource.setDateFilter($scope.dateFilter.startDate, $scope.dateFilter.endDate);
1616
//Get Profile
1717
settingsResource.getprofile().then(function (response) {
1818
$scope.profile = response.data;

Analytics.Site/App_Plugins/Analytics/backOffice/AnalyticsTree/resources/Settings.Resource.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,8 @@ angular.module("umbraco.resources")
5252
if (dateFilter.startDate == null) {
5353
dateFilter.startDate = moment().subtract('days', 29).format('YYYY-MM-DD');
5454
dateFilter.endDate = moment().format('YYYY-MM-DD');
55-
setDateFilter(dateFilter.startDate, dateFilter.endDate);
55+
$cookieStore.put("analyticsStartDate", dateFilter.startDate);
56+
$cookieStore.put("analyticsEndDate", dateFilter.endDate);
5657
}
5758

5859
return dateFilter;

Analytics.Site/App_Plugins/Analytics/backOffice/AnalyticsTree/resources/Stats.Resource.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ angular.module("umbraco.resources")
6969
},
7070

7171
getvisitcharts: function (profileID, startDate, endDate) {
72-
return $http.get("Analytics/AnalyticsApi/GetVisitsOverMonths", { params: { profile: profileID, startDate: startDate, endDate: endDate } });
72+
return $http.get("Analytics/AnalyticsApi/GetVisitsOverTime", { params: { profile: profileID, startDate: startDate, endDate: endDate } });
7373
},
7474

7575
};
Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1 @@
1-
{
2-
"Id": "8245037",
3-
"AccountId": "4113171",
4-
"WebPropertyId": "UA-4113171-1",
5-
"InternalWebPropertyId": "7923617",
6-
"Name": "www.nibble.be",
7-
"Currency": "USD",
8-
"Timezone": "Europe/Brussels",
9-
"WebsiteUrl": "www.nibble.be",
10-
"Type": "WEB",
11-
"Created": "2008-04-13T14:26:12+02:00",
12-
"Updated": "2011-09-20T09:34:04.996+02:00"
13-
}
1+

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
<?xml version="1.0" encoding="utf-8"?>
1+
<?xml version="1.0" encoding="utf-8" ?>
22
<Analytics>
33
<ClientId label="Client ID" description="This is the Client ID key from the Google API">206456221167-1a6npdlit92260gfaekomgon8cm0ratg</ClientId>
44
<ClientSecret label="Client Secret" description="This is the Client Secret from the Google API">_LklwvmJC0EIkEprcRB4keQ_</ClientSecret>
5-
<RefreshToken label="Refresh Token" description="The refresh token used to acquire new access tokens. This is sensitive information.">1/8T0O1zrI2lVG7exZzmvUMlhNQPbN7NL2Tp6ijimsCvo</RefreshToken>
5+
<RefreshToken label="Refresh Token" description="The refresh token used to acquire new access tokens. This is sensitive information."></RefreshToken>
66
</Analytics>

Analytics/App_Plugins/Analytics/backOffice/AnalyticsTree/resources/Stats.Resource.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ angular.module("umbraco.resources")
6969
},
7070

7171
getvisitcharts: function (profileID, startDate, endDate) {
72-
return $http.get("Analytics/AnalyticsApi/GetVisitsOverMonths", { params: { profile: profileID, startDate: startDate, endDate: endDate } });
72+
return $http.get("Analytics/AnalyticsApi/GetVisitsOverTime", { params: { profile: profileID, startDate: startDate, endDate: endDate } });
7373
},
7474

7575
};

Analytics/ChartHelper.cs

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,10 +61,21 @@ public static ChartData GetLineChartData(AnalyticsDataResponse apiResults)
6161
int dimensions = apiResults.ColumnHeaders.Count(x => x.ColumnType == "DIMENSION");
6262
int metrics = apiResults.ColumnHeaders.Count(x => x.ColumnType == "METRIC");
6363

64+
var chartLabels = new string[]{};
65+
66+
if (apiResults.ColumnHeaders.Count() == 5)
67+
{
68+
chartLabels = apiResults.Rows.Select(row => row.Cells[2] + "/" + row.Cells[1] + "/" + row.Cells[0]).ToArray();
69+
}
70+
else
71+
{
72+
chartLabels = apiResults.Rows.Select(row => row.Cells[1] + "/" + row.Cells[0]).ToArray();
73+
}
74+
6475
// Initialize the data object
6576
ChartData cd = new ChartData
6677
{
67-
labels = apiResults.Rows.Select(row => row.Cells[1] + "/" + row.Cells[0]).ToArray(),
78+
labels = chartLabels,
6879
datasets = new LineChartDataSet[metrics]
6980
};
7081

0 commit comments

Comments
 (0)