Skip to content

Commit

Permalink
Merge pull request #471 from guardian/fp/button-telemetry
Browse files Browse the repository at this point in the history
Send telemetry for Commissioned Length Suggestion buttons
  • Loading branch information
Fweddi authored Oct 21, 2024
2 parents 7d4ed55 + 01e8c8e commit cc7010c
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
1 change: 1 addition & 0 deletions public/components/stub-modal/stub-modal.html
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ <h4 class="modal-title">{{ modalTitle }}</h4>
class="btn btn-default btn-sm commissioned-length-suggestion"
ng-model="stub.commissionedLength"
btn-radio="commissionedLengthSuggestion"
ng-click="sendTelemetry(commissionedLengthSuggestion)"
>
{{ commissionedLengthSuggestion }}
</button>
Expand Down
14 changes: 12 additions & 2 deletions public/components/stub-modal/stub-modal.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,16 @@ import 'lib/legal-states-service';
import 'lib/picture-desk-states-service';
import 'lib/filters-service';
import 'lib/prodoffice-service';
import 'lib/telemetry-service';
import { punters } from 'components/punters/punters';

const wfStubModal = angular.module('wfStubModal', [
'ui.bootstrap', 'articleFormatService', 'legalStatesService', 'pictureDeskStatesService', 'wfComposerService', 'wfContentService', 'wfDateTimePicker', 'wfProdOfficeService', 'wfFiltersService', 'wfCapiAtomService'])
'ui.bootstrap', 'articleFormatService', 'legalStatesService', 'pictureDeskStatesService', 'wfComposerService', 'wfContentService', 'wfDateTimePicker', 'wfProdOfficeService', 'wfFiltersService', 'wfCapiAtomService', 'wfTelemetryService'])
.directive('punters', ['$rootScope', punters]);

function StubModalInstanceCtrl($rootScope, $scope, $modalInstance, $window, config, stub, mode,
sections, statusLabels, articleFormatService, legalStatesService, pictureDeskStatesService, wfComposerService, wfProdOfficeService, wfContentService,
wfPreferencesService, wfFiltersService, sectionsInDesks, wfCapiAtomService) {
wfPreferencesService, wfFiltersService, sectionsInDesks, wfCapiAtomService, wfTelemetryService) {

wfContentService.getTypes().then( (types) => {
$scope.contentName =
Expand Down Expand Up @@ -260,6 +261,15 @@ function StubModalInstanceCtrl($rootScope, $scope, $modalInstance, $window, conf
1200,
]

$scope.sendTelemetry = (value) => {
const commissioningDesk = $scope.cdesks.find(desk => desk.id.toString() === stub.commissioningDesks)?.externalName;
wfTelemetryService.sendTelemetryEvent(
"WORKFLOW_COMMISSIONED_LENGTH_SUGGESTION_PRESSED",
{ contentId: stub.id, productionOffice: stub.prodOffice, commissioningDesk },
value
)
}

$scope.submit = function (form) {
if (form.$invalid)
return; // Form is not ready to submit
Expand Down

0 comments on commit cc7010c

Please sign in to comment.