diff --git a/admin-translations.json b/admin-translations.json index 9368e416..1f27fd14 100644 --- a/admin-translations.json +++ b/admin-translations.json @@ -120,7 +120,8 @@ "replace": "replace metadata" }, "lyrics": "Lyrics", - "transcription": "Transcription" + "transcription": "Transcription", + "analytics": "Analytics" }, "waitings": { "link": "Link", diff --git a/admin/app/scripts/controllers/track.js b/admin/app/scripts/controllers/track.js index 8a2514cc..5b270452 100644 --- a/admin/app/scripts/controllers/track.js +++ b/admin/app/scripts/controllers/track.js @@ -100,7 +100,10 @@ angular.module('bmmApp') tags: [], cover: null, cover_upload: null, - rel: [] + rel: [], + analytics: false, + analyticsData: { + } }; return; } @@ -165,6 +168,15 @@ angular.module('bmmApp') }; $scope.refreshModel(); + $scope.getAnalytics = function() { + _api.getAnalytics($routeParams.id) + .done(function(response) { + $scope.model.analyticsData = response; + }); + }; + + $scope.getAnalytics(); + var saveModel = function() { //Delete parts that's unexpected by the API diff --git a/admin/app/views/pages/track.html b/admin/app/views/pages/track.html index 8e7a16c6..903a40cd 100644 --- a/admin/app/views/pages/track.html +++ b/admin/app/views/pages/track.html @@ -262,6 +262,30 @@

{{init.translation.page.editor.available}}

+
+
+

{{init.translation.page.editor.analytics}}

+
+
+
+ Plays:
+ Plays last 90 days:
+ Unique listeners:
+ Completed percentage:
+ + Skip percentage: +
+
+ {{model.analyticsData.plays}}
+ {{model.analyticsData.plays90_days}}
+ {{model.analyticsData.unique_listeners}}
+ {{model.analyticsData.completed_percentage | number : 1}}%
+ {{model.analyticsData.skip_percentage | number : 1}}% +
+ +
+
+
diff --git a/common/app/scripts/services/_api.js b/common/app/scripts/services/_api.js index 4622927a..c8ae7913 100644 --- a/common/app/scripts/services/_api.js +++ b/common/app/scripts/services/_api.js @@ -1211,6 +1211,13 @@ angular.module('bmmLibApp') }) } + factory.getAnalytics = function(trackId) { + return factory.addToQueue({ + method: 'GET', + url: serverUrl + 'statistics/track/'+trackId, + }) + }; + factory.getApkUrl = function(){ return serverUrl + 'file/apk'; }