Skip to content

Commit

Permalink
first draft of showing analytics
Browse files Browse the repository at this point in the history
  • Loading branch information
kkuepper committed Nov 6, 2023
1 parent a3ca784 commit d7e1c18
Show file tree
Hide file tree
Showing 4 changed files with 46 additions and 2 deletions.
3 changes: 2 additions & 1 deletion admin-translations.json
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,8 @@
"replace": "replace metadata"
},
"lyrics": "Lyrics",
"transcription": "Transcription"
"transcription": "Transcription",
"analytics": "Analytics"
},
"waitings": {
"link": "Link",
Expand Down
14 changes: 13 additions & 1 deletion admin/app/scripts/controllers/track.js
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,10 @@ angular.module('bmmApp')
tags: [],
cover: null,
cover_upload: null,
rel: []
rel: [],
analytics: false,
analyticsData: {
}
};
return;
}
Expand Down Expand Up @@ -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
Expand Down
24 changes: 24 additions & 0 deletions admin/app/views/pages/track.html
Original file line number Diff line number Diff line change
Expand Up @@ -262,6 +262,30 @@ <h4>{{init.translation.page.editor.available}}</h4>
</div>
</div>

<div class="foldbox">
<div class="header" ng-click="model.analytics=!model.analytics">
<h3>{{init.translation.page.editor.analytics}}</h3>
</div>
<div class="body" ng-class="{'visible': model.analytics}">
<div style="float: left; margin-right: 1em">
<span title="Played at least 80% on Android or iOS.">Plays:</span> <br />
<span title="Only considers plays from the last 90 days.">Plays last 90 days:</span> <br />
<span title="Number of people that listened to the full song at least once.">Unique listeners:</span> <br />
<span title="How many plays listen to more than 80%.">Completed percentage:</span> <br />
<span title="How many plays are skipped before the end of the song. Whereas Completed percentage takes into account if people stop using BMM or switch to a different playlist, a skip means that the user hit the skip button. (Only iOS for now after 01.11.2023)">
Skip percentage:</span>
</div>
<div style="text-align: right; display: inline-block;">
{{model.analyticsData.plays}} <br />
{{model.analyticsData.plays90_days}} <br />
{{model.analyticsData.unique_listeners}} <br />
{{model.analyticsData.completed_percentage | number : 1}}% <br />
{{model.analyticsData.skip_percentage | number : 1}}%
</div>

</div>
</div>

<div ng-include="'views/pages/relations.html'"
ng-controller="RelationsCtrl"
style="width: 100%;"></div>
Expand Down
7 changes: 7 additions & 0 deletions common/app/scripts/services/_api.js
Original file line number Diff line number Diff line change
Expand Up @@ -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';
}
Expand Down

0 comments on commit d7e1c18

Please sign in to comment.