From 103ebb7043645f644c3967a51e3f4bf900ed5f37 Mon Sep 17 00:00:00 2001
From: Omar
- - -
- -
+
Date: Wed, 18 Dec 2024 09:07:54 +0100
Subject: [PATCH 07/11] feat(dedicated): my services add tracking (#14612)
ref: MANAGER-16208
Signed-off-by: Omar ALKABOUSS MOUSSANA {{ 'payment_expiration_no_default_method_message' | translate}}
@@ -111,7 +111,7 @@
class="oui-link_icon"
data-ng-href="{{ $ctrl.updateLink }}"
data-ng-if="$ctrl.autorenewLink && !$ctrl.serviceInfos.hasParticularRenew() && !$ctrl.serviceInfos.hasPendingResiliation() && !$ctrl.serviceInfos.hasDebt() && !$ctrl.serviceInfos.isOneShot() && !$ctrl.serviceInfos.hasForcedRenew() && !$ctrl.serviceInfos.isResiliated() && $ctrl.serviceInfos.canHandleRenew() && !$ctrl.serviceInfos.hasEngagement()"
- data-ng-click="$ctrl.trackAction('go-to-configure-renew')"
+ data-ng-click="$ctrl.trackAction($ctrl.serviceInfos.hasAutomaticRenew() ?'edit-frequency': 'renew', !$ctrl.serviceInfos.hasAutomaticRenew())"
target="_top"
>
@@ -144,7 +144,7 @@
class="oui-link_icon"
data-ng-href="{{ $ctrl.autorenewLink && !$ctrl.service.hasBillingRights($ctrl.user.nichandle) ? $ctrl.warningLink : $ctrl.billingLink }}"
data-ng-if="$ctrl.serviceInfos.hasDebt()"
- data-on-click="$ctrl.trackAction('go-to-pay-bill')"
+ data-ng-click="$ctrl.trackAction('go-to-pay-bill')"
target="_top"
>
@@ -174,7 +174,7 @@
class="oui-link_icon"
data-ng-if="$ctrl.resiliateLink && ($ctrl.serviceInfos.hasAdminRights($ctrl.user.auth.account) || $ctrl.serviceInfos.hasAdminRights($ctrl.user.nichandle))"
data-ng-href="{{ $ctrl.resiliateLink }}"
- on-click="$ctrl.trackAction('go-to-resiliate')"
+ data-ng-click="$ctrl.trackAction('stop', true)"
target="_top"
>
@@ -202,7 +202,7 @@
class="oui-link_icon"
data-ng-if="$ctrl.resiliateLink && ($ctrl.serviceInfos.hasAdminRights($ctrl.user.auth.account) || $ctrl.serviceInfos.hasAdminRights($ctrl.user.nichandle))"
data-ng-href="{{ $ctrl.resiliateLink }}"
- on-click="$ctrl.trackAction('go-to-resiliate')"
+ data-ng-click="$ctrl.trackAction('stop', true)"
target="_top"
>
diff --git a/packages/manager/modules/billing/src/autoRenew/agreements/user-agreements.routes.js b/packages/manager/modules/billing/src/autoRenew/agreements/user-agreements.routes.js
index bd2fc549f3d8..ecf52db6ef4c 100644
--- a/packages/manager/modules/billing/src/autoRenew/agreements/user-agreements.routes.js
+++ b/packages/manager/modules/billing/src/autoRenew/agreements/user-agreements.routes.js
@@ -1,5 +1,9 @@
import controller from './user-agreements.controller';
import template from './user-agreements.html';
+import {
+ TRACKING_AGREEMENTS_PAGE_NAME,
+ TRACKING_PAGE_CATEGORY,
+} from '../autorenew.constants';
export default /* @ngInject */ (
$stateProvider,
@@ -19,6 +23,15 @@ export default /* @ngInject */ (
(currentUser) =>
currentUser.isTrusted && 'app.account.billing.autorenew',
),
+ atInternet: {
+ ignore: true,
+ },
+ onEnter: /* @ngInject */ (atInternet) => {
+ atInternet.trackPage({
+ name: TRACKING_AGREEMENTS_PAGE_NAME,
+ page_category: TRACKING_PAGE_CATEGORY,
+ });
+ },
resolve: {
gotoAcceptAllAgreements: /* @ngInject */ ($state, atInternet) => (
agreements,
diff --git a/packages/manager/modules/billing/src/autoRenew/autorenew.constants.js b/packages/manager/modules/billing/src/autoRenew/autorenew.constants.js
index f7f4252f026c..ed5d9d24eeea 100644
--- a/packages/manager/modules/billing/src/autoRenew/autorenew.constants.js
+++ b/packages/manager/modules/billing/src/autoRenew/autorenew.constants.js
@@ -75,6 +75,22 @@ export const SERVICE_STATUS = {
export const URL_PARAMETER_SEPARATOR = '%20';
+const TRACKING_CHAPTER_1 = 'Hub';
+const TRACKING_CHAPTER_2 = 'billing';
+const TRACKING_CHAPTER_3 = 'services';
+
+const TRACKING_PAGE_SUFFIX = 'services::listing::autorenew';
+export const TRACKING_PAGE_CATEGORY = 'listing';
+export const TRACKING_PAGE = `${TRACKING_CHAPTER_1}::${TRACKING_CHAPTER_2}::${TRACKING_CHAPTER_3}::${TRACKING_PAGE_SUFFIX}`;
+export const TRACKING_FILTER_NAME_PREFIX =
+ 'Hub::billing::services::listing::button::filter_services';
+
+export const TRACKING_AUTORENEW_PAGE_NAME = `Hub::billing::services::services::listing::autorenew`;
+export const TRACKING_SSH_PAGE_NAME = `${TRACKING_AUTORENEW_PAGE_NAME}::ssh`;
+export const TRACKING_AGREEMENTS_PAGE_NAME = `${TRACKING_AUTORENEW_PAGE_NAME}::agreements`;
+
+export const TRACKING_ACTIONS_PREFIX = `${TRACKING_CHAPTER_1}::${TRACKING_CHAPTER_2}::${TRACKING_CHAPTER_3}::${TRACKING_PAGE_CATEGORY}`;
+
export default {
AUTORENEW_EVENT,
CONTRACTS_IDS,
diff --git a/packages/manager/modules/billing/src/autoRenew/autorenew.controller.js b/packages/manager/modules/billing/src/autoRenew/autorenew.controller.js
index bbb40e667da8..161185fa93a2 100644
--- a/packages/manager/modules/billing/src/autoRenew/autorenew.controller.js
+++ b/packages/manager/modules/billing/src/autoRenew/autorenew.controller.js
@@ -10,6 +10,10 @@ import {
COLUMNS_CONFIG,
NIC_ALL,
URL_PARAMETER_SEPARATOR,
+ TRACKING_FILTER_NAME_PREFIX,
+ TRACKING_PAGE_CATEGORY,
+ TRACKING_PAGE,
+ TRACKING_ACTIONS_PREFIX,
} from './autorenew.constants';
export default class AutorenewCtrl {
@@ -35,6 +39,10 @@ export default class AutorenewCtrl {
}
$onInit() {
+ this.trackingPage = TRACKING_PAGE;
+ this.trackingCategory = TRACKING_PAGE_CATEGORY;
+ this.trackingActionsPrefix = TRACKING_ACTIONS_PREFIX;
+
this.ALIGNMENT_URL = this.coreConfig.isRegion('EU')
? ALIGNMENT_URLS[this.currentUser.ovhSubsidiary] || ALIGNMENT_URLS.FR
: null;
@@ -86,6 +94,7 @@ export default class AutorenewCtrl {
this.hideHeaderGuide =
Object.keys(this.guides.url.my_services).length === 0;
}
+ this.currentCriteria = JSON.parse(JSON.stringify(this.criteria));
}
descriptionOfHeading() {
@@ -198,6 +207,13 @@ export default class AutorenewCtrl {
}
onCriteriaChange($criteria) {
+ const newCriteria = $criteria.find(
+ (f) =>
+ !this.currentCriteria.some(
+ (s) => s.property === f.property && s.value === f.value,
+ ),
+ );
+
const selectedType = find($criteria, { property: 'serviceType' });
const searchText = find($criteria, { property: null });
const filters = reduce(
@@ -215,6 +231,17 @@ export default class AutorenewCtrl {
{},
);
+ if (newCriteria) {
+ this.atInternet.trackClick({
+ name: `${TRACKING_FILTER_NAME_PREFIX}::go-to-${newCriteria.property?.toLowerCase()}-${newCriteria.value?.toLowerCase()}::service`,
+ type: 'action',
+ page_category: TRACKING_PAGE_CATEGORY,
+ page: {
+ name: TRACKING_PAGE,
+ },
+ });
+ }
+
this.onListParamChanges({
filters: JSON.stringify(filters),
selectedType: get(selectedType, 'value'),
diff --git a/packages/manager/modules/billing/src/autoRenew/autorenew.html b/packages/manager/modules/billing/src/autoRenew/autorenew.html
index 9382d7964fc9..bcd8b6868ebc 100644
--- a/packages/manager/modules/billing/src/autoRenew/autorenew.html
+++ b/packages/manager/modules/billing/src/autoRenew/autorenew.html
@@ -76,7 +76,11 @@
From 9b6045ed1c5dbac056c9af97b8857127ddbf3d8c Mon Sep 17 00:00:00 2001
From: Omar
+
+
+