Skip to content

Commit

Permalink
feat(web.domain): add tracking for domain optim
Browse files Browse the repository at this point in the history
ref:MANAGER-15599

Signed-off-by: stif59100 <[email protected]>
  • Loading branch information
stif59100 committed Oct 10, 2024
1 parent cb1d1bd commit ec21cc1
Show file tree
Hide file tree
Showing 8 changed files with 153 additions and 14 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
import { ListLayoutHelper } from '@ovh-ux/manager-ng-layout-helpers';
import { getDomainOrderUrl } from './domains.order';
import {
DOMAIN_PREFIX_PAGE_BUTTON,
DOMAIN_PREFIX_LISTING_MANAGE_DOMAINS,
} from '../domains/domains.constant';

export default /* @ngInject */ ($stateProvider) => {
$stateProvider.state('app.domain.index', {
Expand Down Expand Up @@ -65,7 +69,7 @@ export default /* @ngInject */ ($stateProvider) => {
value: $translate.instant('domains_order'),
onClick: () => {
atInternet.trackClick({
name: 'web::domain::index::order',
name: `${DOMAIN_PREFIX_PAGE_BUTTON}go-to-order::domain`,
type: 'action',
});
$window.open(
Expand All @@ -79,5 +83,8 @@ export default /* @ngInject */ ($stateProvider) => {
$state.go('app.domain.index.restore-renew', { domains }),
hideBreadcrumb: () => true,
},
atInternet: {
rename: `${DOMAIN_PREFIX_LISTING_MANAGE_DOMAINS}`,
},
});
};
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,14 @@ import {
PRODUCT_TYPE,
} from './list-domain-layout.constants';

import {
DOMAIN_PREFIX_PAGE_BUTTON_RENEW_RESTORE_DOMAIN,
DOMAIN_PREFIX_PAGE_BUTTON_EXPORT_CSV_DOMAIN,
DOMAIN_PREFIX_PAGE_BUTTON_DATAGRID_LINK,
DOMAIN_PREFIX_PAGE_BUTTON_DATAGRID,
DOMAIN,
} from '../../domains/domains.constant';

export default class ListDomainLayoutCtrl extends ListLayoutHelper.ListLayoutCtrl {
/* @ngInject */
constructor(
Expand All @@ -35,6 +43,7 @@ export default class ListDomainLayoutCtrl extends ListLayoutHelper.ListLayoutCtr
$scope,
$timeout,
$window,
atInternet,
) {
super($q, ouiDatagridService);
this.$translate = $translate;
Expand All @@ -53,12 +62,15 @@ export default class ListDomainLayoutCtrl extends ListLayoutHelper.ListLayoutCtr
this.DOMAINS_BADGES_RENEWAL_MODE = DOMAINS_BADGES_RENEWAL_MODE;
this.IDN_PREFIX = IDN_PREFIX;
this.DOMAIN_OBJECT_KEYS = DOMAIN_OBJECT_KEYS;
this.DOMAIN_PREFIX_PAGE_BUTTON_RENEW_RESTORE_DOMAIN = DOMAIN_PREFIX_PAGE_BUTTON_RENEW_RESTORE_DOMAIN;
this.DOMAIN_PREFIX_PAGE_BUTTON_EXPORT_CSV_DOMAIN = DOMAIN_PREFIX_PAGE_BUTTON_EXPORT_CSV_DOMAIN;
this.coreURLBuilder = coreURLBuilder;
this.user = coreConfig.getUser();
this.Domain = Domain;
this.$scope = $scope;
this.$timeout = $timeout;
this.$window = $window;
this.atInternet = atInternet;
}

$onInit() {
Expand Down Expand Up @@ -270,6 +282,20 @@ export default class ListDomainLayoutCtrl extends ListLayoutHelper.ListLayoutCtr
);
}

trackDomainLinkClick(track) {
this.atInternet.trackClick({
name: `${DOMAIN_PREFIX_PAGE_BUTTON_DATAGRID_LINK}${track}::${DOMAIN}`,
type: 'action',
});
}

trackDomainButtonClick(track) {
this.atInternet.trackClick({
name: `${DOMAIN_PREFIX_PAGE_BUTTON_DATAGRID}::${track}::${DOMAIN}`,
type: 'action',
});
}

static isDomainRenewableOrRestorable(domain) {
return (
![
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,29 @@
export default class webDomainRestoreRenewCtrl {
import {
DOMAIN_PREFIX_POPUP_BUTTON_RENEW_GO_TO_ORDER,
DOMAIN_PREFIX_POPUP_BUTTON_RENEW_CANCEL,
} from '../../../domains/domains.constant';

export default class WebDomainRestoreRenewCtrl {
/* @ngInject */
constructor($window, constants) {
constructor($window, constants, atInternet) {
this.$window = $window;
this.constants = constants;
this.atInternet = atInternet;
}

closeModal() {
this.atInternet.trackClick({
name: `${DOMAIN_PREFIX_POPUP_BUTTON_RENEW_CANCEL}`,
type: 'action',
});
return this.goBack();
}

redirectToRenew() {
this.atInternet.trackClick({
name: `${DOMAIN_PREFIX_POPUP_BUTTON_RENEW_GO_TO_ORDER}`,
type: 'action',
});
this.$window.open(
URI.expand(this.constants.renew, {
serviceName: this.domains.map((domain) => domain.domain).join(' '),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
data-primary-action="$ctrl.redirectToRenew()"
data-primary-label="{{:: 'domains_restore_renew_modal_confirm' | translate }}"
data-primary-disabled="!$ctrl.domains.length"
data-secondary-action="$ctrl.goBack()"
data-secondary-action="$ctrl.closeModal()"
data-secondary-label="{{:: 'domains_restore_renew_modal_cancel' | translate }}"
data-on-dismiss="$ctrl.goBack()"
>
Expand Down
35 changes: 27 additions & 8 deletions packages/manager/apps/web/client/app/domain/list/template.html
Original file line number Diff line number Diff line change
Expand Up @@ -27,18 +27,25 @@
<oui-datagrid-topbar data-ng-if="$ctrl.topbarOptions">
<topbar-cta data-options="$ctrl.topbarOptions"></topbar-cta>
<div class="d-inline" data-ng-if="$ctrl.resources.data.length">
<oui-button
data-variant="secondary"
data-disabled="!$ctrl.selectedRows.length"
<button
class="oui-button oui-button_secondary"
type="button"
data-ng-disabled="!$ctrl.selectedRows.length"
data-ng-click="$ctrl.goToRestoreRenew($ctrl.selectedRows)"
data-track-on="click"
data-track-type="action"
data-track-name="{{$ctrl.DOMAIN_PREFIX_PAGE_BUTTON_RENEW_RESTORE_DOMAIN}}"
>
<span data-translate="domains_action_restore_renew"></span>
</oui-button>

<oui-button
data-variant="secondary"
</button>
<button
class="oui-button oui-button_secondary"
type="button"
data-ng-click="$ctrl.setActionMultiple('export-csv/domains-export-to-csv')"
data-ng-disabled="$ctrl.loading.domainsExportCsv"
data-track-on="click"
data-track-type="action"
data-track-name="{{$ctrl.DOMAIN_PREFIX_PAGE_BUTTON_EXPORT_CSV_DOMAIN}}"
>
<span
data-translate="domains_dashboard_button_export"
Expand All @@ -48,7 +55,7 @@
data-translate="domains_dashboard_tooltip_export_csv_creation_doing"
data-ng-if="$ctrl.loading.domainsExportCsv"
></span>
</oui-button>
</button>
</div>
</oui-datagrid-topbar>
<oui-datagrid-column
Expand All @@ -62,6 +69,7 @@
<a
data-ng-href="{{:: $ctrl.getServiceNameLink($row) }}"
data-ng-bind="$ctrl.constructor.convertToPunycode($value)"
data-ng-click="$ctrl.trackDomainLinkClick('domain_name')"
></a>
<button
data-ng-if="$ctrl.isIdn($value)"
Expand Down Expand Up @@ -161,6 +169,7 @@
class="oui-link_icon"
data-ng-href="{{:: $ctrl.linkToOwnerPage($row.contactOwner.id, $row.domain)}}"
target="_top"
data-ng-click="$ctrl.trackDomainLinkClick('contact-owner')"
>
<span data-ng-bind=":: $row.contactOwner.id"></span>
</a>
Expand Down Expand Up @@ -194,6 +203,7 @@
data-ng-if="$row.contactAdmin.id === $ctrl.user.auth.account"
data-ng-href="{{:: $ctrl.USER_ACCOUNT_INFOS_LINK }}"
target="_top"
data-ng-click="$ctrl.trackDomainLinkClick('contact-admin')"
>
<span data-ng-bind=":: $row.contactAdmin.id"></span>
<span
Expand All @@ -219,6 +229,7 @@
data-ng-if="$row.contactBilling.id === $ctrl.user.auth.account"
data-ng-href="{{:: $ctrl.USER_ACCOUNT_INFOS_LINK }}"
target="_top"
data-ng-click="$ctrl.trackDomainLinkClick('contact-billing')"
>
<span data-ng-bind=":: $row.contactBilling.id"></span>
<span
Expand All @@ -244,6 +255,7 @@
data-ng-if="$row.contactTech.id === $ctrl.user.auth.account"
data-ng-href="{{:: $ctrl.USER_ACCOUNT_INFOS_LINK }}"
target="_top"
data-ng-click="$ctrl.trackDomainLinkClick('contact-technical')"
>
<span data-ng-bind=":: $row.contactTech.id"></span>
<span
Expand Down Expand Up @@ -285,13 +297,15 @@
data-href="{{:: $ctrl.getServiceNameLink($row)}}"
aria-label="{{:: 'domains_action_per_line_detail' | translate }}"
data-ng-if="![$ctrl.DOMAIN_STATUS.PENDING_INCOMING_TRANSFER, $ctrl.DOMAIN_STATUS.PENDING_CREATE].includes($row.state)"
data-ng-click="$ctrl.trackDomainButtonClick('domain-name-details')"
>
<span data-translate="domains_action_per_line_detail"></span>
</oui-action-menu-item>
<oui-action-menu-item
data-on-click="$ctrl.goToRestoreRenew($row)"
aria-label="{{:: $row.state === $ctrl.DOMAIN_STATUS.RESTORABLE ? 'domains_action_per_line_restore' : 'domains_action_per_line_renew' | translate }}"
data-ng-if="$ctrl.constructor.isDomainRenewableOrRestorable($row)"
data-ng-click="$ctrl.trackDomainButtonClick('renew')"
>
<span
data-translate="{{ $row.state === $ctrl.DOMAIN_STATUS.RESTORABLE ? 'domains_action_per_line_restore' : 'domains_action_per_line_renew' }}"
Expand All @@ -301,6 +315,7 @@
data-href="{{:: $ctrl.CANCEL_LINK + $row.domain }}"
aria-label="{{:: 'domains_action_per_line_cancellation' | translate }}"
data-ng-if="$ctrl.constructor.isDomainCancellable($row)"
data-ng-click="$ctrl.trackDomainButtonClick('terminate')"
top
>
<span
Expand All @@ -311,6 +326,7 @@
data-on-click="$ctrl.goToResiliateCancelation($row)"
aria-label="{{:: 'domains_action_per_line_resiliation_cancellation' | translate }}"
data-ng-if="$row.contactAdmin.id === $ctrl.user.auth.account && $row.renewalState === $ctrl.DOMAIN_RENEWABLE_STATE.CANCELLATION_REQUESTED"
data-ng-click="$ctrl.trackDomainButtonClick('cancel-terminate')"
top
>
<span
Expand All @@ -321,6 +337,7 @@
data-on-click="$ctrl.goToRenewManagementEnable($row)"
aria-label="{{:: 'domains_action_per_line_autorenew_activate' | translate }}"
data-ng-if="$row.renewalState === $ctrl.DOMAIN_RENEWABLE_STATE.MANUAL_RENEW"
data-ng-click="$ctrl.trackDomainButtonClick('enable-automatic-renewal')"
>
<span
data-translate="domains_action_per_line_autorenew_activate"
Expand All @@ -330,13 +347,15 @@
data-on-click="$ctrl.goToRenewManagementDisable($row)"
aria-label="{{:: 'domains_action_per_line_autorenew_deactivate' | translate }}"
data-ng-if="$row.renewalState === $ctrl.DOMAIN_RENEWABLE_STATE.AUTOMATIC_RENEW"
data-ng-click="$ctrl.trackDomainButtonClick('disable-automatic-renewal')"
>
<span
data-translate="domains_action_per_line_autorenew_deactivate"
></span>
</oui-action-menu-item>
<oui-action-menu-item
data-on-click="$ctrl.goToContactManagementEdit($row.domain)"
data-ng-click="$ctrl.trackDomainButtonClick('manage-contact')"
aria-label="{{:: 'common_manage_contacts' | translate }}"
>
<span data-translate="common_manage_contacts"></span>
Expand Down
36 changes: 36 additions & 0 deletions packages/manager/apps/web/client/app/domains/domains.constant.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
export const WEB_DOMAIN = 'web::domain';
export const BUTTON = 'button';
export const CANCEL = 'cancel';
export const DATAGRID = 'datagrid';
export const DOMAIN = 'domain';
export const DOMAINS = 'domains';
export const ERROR = 'error';
export const EXPORT_CSV = 'export-csv';
export const EXPORT_CSV_DOMAINS = 'export-domains-csv';
export const GO_TO_ORDER = 'go-to-order';
export const LINK_DETAILS = 'link_details';
export const LISTING = 'listing';
export const MANAGE_DOMAINS = 'manage_domains';
export const PAGE = 'page';
export const POPUP = 'pop-up';
export const RENEW_RESTORE = 'renew_restore';
export const SUCCESS = 'success';

export const DOMAIN_PREFIX_LISTING = `${WEB_DOMAIN}::${LISTING}`;
export const DOMAIN_PREFIX_LISTING_MANAGE_DOMAINS = `${DOMAIN_PREFIX_LISTING}::${MANAGE_DOMAINS}`;

export const DOMAIN_PREFIX_LISTING_EXPORT = `${WEB_DOMAIN}::${LISTING}::${EXPORT_CSV}`;
export const DOMAIN_PREFIX_LISTING_EXPORT_SUCCESS = `${DOMAIN_PREFIX_LISTING_EXPORT}::${SUCCESS}`;
export const DOMAIN_PREFIX_LISTING_EXPORT_ERROR = `${DOMAIN_PREFIX_LISTING_EXPORT}::${ERROR}`;

export const DOMAIN_PREFIX_PAGE_BUTTON = `${WEB_DOMAIN}::${PAGE}::${BUTTON}`;
export const DOMAIN_PREFIX_PAGE_BUTTON_EXPORT_CSV_DOMAIN = `${WEB_DOMAIN}::${PAGE}::${BUTTON}::${EXPORT_CSV}::${DOMAIN}`;
export const DOMAIN_PREFIX_PAGE_BUTTON_RENEW_RESTORE_DOMAIN = `${WEB_DOMAIN}::${PAGE}::${BUTTON}::${RENEW_RESTORE}-${DOMAIN}`;
export const DOMAIN_PREFIX_PAGE_BUTTON_DATAGRID_LINK = `${WEB_DOMAIN}::${DATAGRID}::${LINK_DETAILS}_`;
export const DOMAIN_PREFIX_PAGE_BUTTON_DATAGRID = `${WEB_DOMAIN}::${DATAGRID}::${BUTTON}`;

export const DOMAIN_PREFIX_POPUP_BUTTON = `${WEB_DOMAIN}::${POPUP}::${BUTTON}`;
export const DOMAIN_PREFIX_POPUP_BUTTON_RENEW_CANCEL = `${DOMAIN_PREFIX_POPUP_BUTTON}::${RENEW_RESTORE}::${DOMAINS}::${CANCEL}`;
export const DOMAIN_PREFIX_POPUP_BUTTON_RENEW_GO_TO_ORDER = `${WEB_DOMAIN}::${POPUP}::${BUTTON}::${RENEW_RESTORE}-${DOMAINS}::${GO_TO_ORDER}`;
export const DOMAIN_PREFIX_POPUP_BUTTON_EXPORT_CSV_DOMAIN = `${DOMAIN_PREFIX_POPUP_BUTTON}::${EXPORT_CSV_DOMAINS}`;
export const DOMAIN_PREFIX_POPUP_BUTTON_CANCEL_EXPORT_CSV_DOMAIN = `${DOMAIN_PREFIX_POPUP_BUTTON_EXPORT_CSV_DOMAIN}::${CANCEL}`;
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@ angular.module('App').config(($stateProvider, $urlRouterProvider) => {
],
hideBreadcrumb: () => true,
},
atInternet: {
rename: 'web::domain::listing::manage_domains',
},
translations: { value: ['../domain', '../domains'], format: 'json' },
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,18 +6,32 @@ import map from 'lodash/map';
import size from 'lodash/size';
import trim from 'lodash/trim';
import uniq from 'lodash/uniq';
import {
DOMAIN_PREFIX_LISTING_EXPORT,
DOMAIN_PREFIX_POPUP_BUTTON_EXPORT_CSV_DOMAIN,
DOMAIN_PREFIX_POPUP_BUTTON_CANCEL_EXPORT_CSV_DOMAIN,
} from '../domains.constant';

angular.module('App').controller(
'DomainsToCsvCtrl',
class DomainsToCsvCtrl {
/* @ngInject */
constructor($scope, $rootScope, $q, $translate, Domain, exportCsv) {
constructor(
$scope,
$rootScope,
$q,
$translate,
Domain,
exportCsv,
atInternet,
) {
this.$scope = $scope;
this.$rootScope = $rootScope;
this.$q = $q;
this.$translate = $translate;
this.Domain = Domain;
this.exportCsv = exportCsv;
this.atInternet = atInternet;
}

$onInit() {
Expand Down Expand Up @@ -110,14 +124,26 @@ angular.module('App').controller(
this.exportStatus.doing = false;
this.exportResults.data = data;
this.exportResults.success = true;
this.atInternet.trackPage({
name: `${DOMAIN_PREFIX_LISTING_EXPORT}success`,
});
});
this.$scope.$on('domain.csv.export.error', () => {
this.exportStatus.doing = false;
this.exportResults.error = true;
this.atInternet.trackPage({
name: `${DOMAIN_PREFIX_LISTING_EXPORT}error`,
});
});

this.$scope.closeExport = () => this.closeExport();
this.$scope.exportAccounts = () => this.exportAccountsToCsv();
this.$scope.exportAccounts = () => {
this.atInternet.trackClick({
name: `${DOMAIN_PREFIX_POPUP_BUTTON_EXPORT_CSV_DOMAIN}`,
type: 'action',
});
return this.exportAccountsToCsv();
};
}

/**
Expand Down Expand Up @@ -209,6 +235,10 @@ angular.module('App').controller(
}

closeExport() {
this.atInternet.trackClick({
name: `${DOMAIN_PREFIX_POPUP_BUTTON_CANCEL_EXPORT_CSV_DOMAIN}`,
type: 'action',
});
this.canceler = true;
this.$scope.resetAction();
}
Expand Down

0 comments on commit ec21cc1

Please sign in to comment.