From 568652d0d84436ea22e873a43a34c231a35f3eb4 Mon Sep 17 00:00:00 2001 From: Guillaume Hyenne Date: Tue, 7 Jan 2025 17:14:58 +0100 Subject: [PATCH] fix(web.domain): update tracking for contact management ref: MANAGER-15859 Signed-off-by: Guillaume Hyenne --- .../app/domain/contact/contact.constants.js | 23 +++++++++++-- .../app/domain/contact/contact.controller.js | 9 +++--- .../app/domain/contact/contact.routing.js | 7 ++-- .../app/domain/contact/edit/edit.constants.js | 32 ++++++++++++++++--- .../domain/contact/edit/edit.controller.js | 14 +++++++- .../app/domain/contact/edit/edit.routing.js | 27 +++++++++++++--- .../app/domain/dashboard/domain.constant.js | 8 +++++ .../app/domain/dashboard/domain.controller.js | 12 ++++++- .../client/app/domain/dashboard/domain.html | 1 + 9 files changed, 113 insertions(+), 20 deletions(-) diff --git a/packages/manager/apps/web/client/app/domain/contact/contact.constants.js b/packages/manager/apps/web/client/app/domain/contact/contact.constants.js index c12aee37ff7b..3f8c85d7db49 100644 --- a/packages/manager/apps/web/client/app/domain/contact/contact.constants.js +++ b/packages/manager/apps/web/client/app/domain/contact/contact.constants.js @@ -190,10 +190,27 @@ export const GUIDE_URLS = { export const LEGAL_FORM_INDIVIDUAL = 'individual'; +const TRACKING_PREFIX = 'web::domain::domain-name::'; + +const TRACKING_CATEGORY_AND_THEME = { + page_category: 'dashboard', + page_theme: 'Domains', + page: { name: TRACKING_PREFIX }, +}; + export const CONTACT_MANAGEMENT_TRACKING = { - PREFIX: 'web::domain::domain-name::', - REASSIGN_CONTACT: 'page::button::reset_domain-name-contacts', - EDIT_CONTACT: 'tile::button::edit_{{contactType}}-contact', + PAGE: { + name: `${TRACKING_PREFIX}domain-name::dashboard::contact-management`, + ...TRACKING_CATEGORY_AND_THEME, + }, + REASSIGN_CONTACT: { + name: `${TRACKING_PREFIX}page::button::reset_domain-name-contacts`, + ...TRACKING_CATEGORY_AND_THEME, + }, + EDIT_CONTACT: { + name: `${TRACKING_PREFIX}tile::button::edit_{{contactType}}-contact`, + ...TRACKING_CATEGORY_AND_THEME, + }, }; export default { diff --git a/packages/manager/apps/web/client/app/domain/contact/contact.controller.js b/packages/manager/apps/web/client/app/domain/contact/contact.controller.js index a04f9bb2846e..dd398c5383c0 100644 --- a/packages/manager/apps/web/client/app/domain/contact/contact.controller.js +++ b/packages/manager/apps/web/client/app/domain/contact/contact.controller.js @@ -94,12 +94,13 @@ export default class DomainContactDashboardCtrl { } editContact(contactType) { - this.trackClick( - CONTACT_MANAGEMENT_TRACKING.EDIT_CONTACT.replace( + this.trackClick({ + ...CONTACT_MANAGEMENT_TRACKING.EDIT_CONTACT, + name: CONTACT_MANAGEMENT_TRACKING.EDIT_CONTACT.name.replace( '{{contactType}}', contactType, ), - ); + }); if (contactType !== 'holder') { return window.open(this.USER_ACCOUNT_INFOS_LINK, '_blank'); } @@ -147,7 +148,7 @@ export default class DomainContactDashboardCtrl { trackClick(hit) { this.atInternet.trackClick({ - name: `${CONTACT_MANAGEMENT_TRACKING.PREFIX}${hit}`, + ...hit, type: 'action', }); } diff --git a/packages/manager/apps/web/client/app/domain/contact/contact.routing.js b/packages/manager/apps/web/client/app/domain/contact/contact.routing.js index fb8f813111cc..a224aba41995 100644 --- a/packages/manager/apps/web/client/app/domain/contact/contact.routing.js +++ b/packages/manager/apps/web/client/app/domain/contact/contact.routing.js @@ -1,4 +1,5 @@ import { PRODUCT_TYPE } from '../list/list-domain-layout.constants'; +import { CONTACT_MANAGEMENT_TRACKING } from './contact.constants'; export default /* @ngInject */ ($stateProvider) => { $stateProvider.state('app.domain.product.contact', { @@ -22,8 +23,10 @@ export default /* @ngInject */ ($stateProvider) => { $state.go('app.domain.product.zone'), }, atInternet: { - rename: - 'web::domain::domain-name::domain-name::dashboard::contact-management', + ignore: true, + }, + onEnter: /* @ngInject */ (atInternet) => { + atInternet.trackPage(CONTACT_MANAGEMENT_TRACKING.PAGE); }, }); }; diff --git a/packages/manager/apps/web/client/app/domain/contact/edit/edit.constants.js b/packages/manager/apps/web/client/app/domain/contact/edit/edit.constants.js index 120f861d4bda..39fdd2cf165c 100644 --- a/packages/manager/apps/web/client/app/domain/contact/edit/edit.constants.js +++ b/packages/manager/apps/web/client/app/domain/contact/edit/edit.constants.js @@ -110,11 +110,35 @@ export const REGEX = { PHONE: /^\+(\d{1,5}\.)?\d{1,15}$/, }; +const TRACKING_PREFIX = 'web::domain::domain-name::'; + +const TRACKING_CATEGORY_AND_THEME = { + page_category: 'funnel', + page_theme: 'Domains', + page: { name: TRACKING_PREFIX }, +}; + export const CONTACT_MANAGEMENT_EDIT_TRACKING = { - PREFIX: 'web::domain::domain-name::funnel::', - SUBMIT: 'button::edit_holder-contact_confirm', - CANCEL: 'button::edit_holder-contact_cancel', - LINK: 'link::edit_holder_next', + PAGE: { + name: `${TRACKING_PREFIX}domain-name::funnel::edit_holder-contact`, + ...TRACKING_CATEGORY_AND_THEME, + }, + BANNER: { + name: `${TRACKING_PREFIX}domain-name::funnel::edit_holder-contact::banner-{{bannerType}}::edit-holder-contact_{{bannerType}}`, + ...TRACKING_CATEGORY_AND_THEME, + }, + SUBMIT: { + name: `${TRACKING_PREFIX}funnel::button::edit_holder-contact_confirm`, + ...TRACKING_CATEGORY_AND_THEME, + }, + CANCEL: { + name: `${TRACKING_PREFIX}funnel::button::edit_holder-contact_cancel`, + ...TRACKING_CATEGORY_AND_THEME, + }, + LINK: { + name: `${TRACKING_PREFIX}funnel::link::edit_holder_next`, + ...TRACKING_CATEGORY_AND_THEME, + }, }; export default { diff --git a/packages/manager/apps/web/client/app/domain/contact/edit/edit.controller.js b/packages/manager/apps/web/client/app/domain/contact/edit/edit.controller.js index bae80648a19c..ccc869958d0b 100644 --- a/packages/manager/apps/web/client/app/domain/contact/edit/edit.controller.js +++ b/packages/manager/apps/web/client/app/domain/contact/edit/edit.controller.js @@ -204,6 +204,7 @@ export default class DomainContactEditCtrl { ), 'InfoErrors', ); + this.trackErrorBanner(); }), ) .catch((error) => { @@ -222,6 +223,7 @@ export default class DomainContactEditCtrl { }`, 'InfoErrors', ); + this.trackErrorBanner(); }) .finally(() => { this.isSubmitting = false; @@ -235,8 +237,18 @@ export default class DomainContactEditCtrl { trackClick(hit) { this.atInternet.trackClick({ - name: `${CONTACT_MANAGEMENT_EDIT_TRACKING.PREFIX}${hit}`, + ...hit, type: 'action', }); } + + trackErrorBanner() { + this.atInternet.trackPage({ + ...CONTACT_MANAGEMENT_EDIT_TRACKING.BANNER, + name: CONTACT_MANAGEMENT_EDIT_TRACKING.BANNER.name.replace( + /{{bannerType}}/g, + 'error', + ), + }); + } } diff --git a/packages/manager/apps/web/client/app/domain/contact/edit/edit.routing.js b/packages/manager/apps/web/client/app/domain/contact/edit/edit.routing.js index 6a44f7b4f8d5..26f37dee741c 100644 --- a/packages/manager/apps/web/client/app/domain/contact/edit/edit.routing.js +++ b/packages/manager/apps/web/client/app/domain/contact/edit/edit.routing.js @@ -1,3 +1,5 @@ +import { CONTACT_MANAGEMENT_EDIT_TRACKING } from './edit.constants'; + export default /* @ngInject */ ($stateProvider) => { $stateProvider.state('app.domain.product.contact.edit', { url: '/edit-contact/:contactId/', @@ -15,22 +17,37 @@ export default /* @ngInject */ ($stateProvider) => { $transition$.params().contactId, contactInformations: /* @ngInject */ (contactId, ContactService) => ContactService.getDomainContactInformations(contactId), - goBack: /* @ngInject */ ($state, Alerter) => ( + goBack: /* @ngInject */ ($state, Alerter, $timeout, atInternet) => ( message = false, type = 'success', ) => { - const promise = $state.go('app.domain.product.contact'); + const promise = $state.go('app.domain.product.contact', null, { + reload: !!message, + }); if (message) { - promise.then(() => Alerter[type](message, 'dashboardContact')); + promise.then(() => + $timeout(() => { + Alerter[type](message, 'dashboardContact'); + atInternet.trackPage({ + ...CONTACT_MANAGEMENT_EDIT_TRACKING.BANNER, + name: CONTACT_MANAGEMENT_EDIT_TRACKING.BANNER.name.replace( + /{{bannerType}}/g, + type, + ), + }); + }, 1000), + ); } return promise; }, }, atInternet: { - rename: - 'web::domain::domain-name::domain-name::funnel::edit_holder-contact', + ignore: true, + }, + onEnter: /* @ngInject */ (atInternet) => { + atInternet.trackPage(CONTACT_MANAGEMENT_EDIT_TRACKING.PAGE); }, }); }; diff --git a/packages/manager/apps/web/client/app/domain/dashboard/domain.constant.js b/packages/manager/apps/web/client/app/domain/dashboard/domain.constant.js index d6c754c49347..141d72996920 100644 --- a/packages/manager/apps/web/client/app/domain/dashboard/domain.constant.js +++ b/packages/manager/apps/web/client/app/domain/dashboard/domain.constant.js @@ -52,6 +52,13 @@ export const DOMAIN_OPTION_STATUS = { INACTIVE: 'released', }; +export const CONTACT_MANAGEMENT_TRACKING = { + name: + 'web::domain::domain-name::main-tabnav::go-to-tab::contact-management_domain-name', + page_theme: 'Domains', + type: 'action', +}; + export default { ALERTS, WHOIS_STATUS, @@ -59,6 +66,7 @@ export default { DOMAIN_OPTION_STATUS, RENEW_URL, DOMAIN_SERVICE_STATUS, + CONTACT_MANAGEMENT_TRACKING, }; angular.module('App').constant('DOMAIN', { diff --git a/packages/manager/apps/web/client/app/domain/dashboard/domain.controller.js b/packages/manager/apps/web/client/app/domain/dashboard/domain.controller.js index 3a995b7fa0e0..5243c3af8d4a 100644 --- a/packages/manager/apps/web/client/app/domain/dashboard/domain.controller.js +++ b/packages/manager/apps/web/client/app/domain/dashboard/domain.controller.js @@ -1,7 +1,11 @@ import filter from 'lodash/filter'; import get from 'lodash/get'; -import { RENEW_URL, DOMAIN_SERVICE_STATUS } from './domain.constant'; +import { + RENEW_URL, + DOMAIN_SERVICE_STATUS, + CONTACT_MANAGEMENT_TRACKING, +} from './domain.constant'; angular.module('App').controller( 'DomainCtrl', @@ -16,6 +20,7 @@ angular.module('App').controller( $timeout, $translate, Alerter, + atInternet, constants, coreURLBuilder, Domain, @@ -38,6 +43,7 @@ angular.module('App').controller( this.$timeout = $timeout; this.$translate = $translate; this.Alerter = Alerter; + this.atInternet = atInternet; this.constants = constants; this.Domain = Domain; this.coreURLBuilder = coreURLBuilder; @@ -264,5 +270,9 @@ angular.module('App').controller( getState() { return this.isAllDom ? 'app.alldom.domain' : 'app.domain.product'; } + + trackClickContactManagement() { + this.atInternet.trackClick(CONTACT_MANAGEMENT_TRACKING); + } }, ); diff --git a/packages/manager/apps/web/client/app/domain/dashboard/domain.html b/packages/manager/apps/web/client/app/domain/dashboard/domain.html index d4b7904aff7c..2c6b6fed01bd 100644 --- a/packages/manager/apps/web/client/app/domain/dashboard/domain.html +++ b/packages/manager/apps/web/client/app/domain/dashboard/domain.html @@ -141,6 +141,7 @@