Skip to content

Commit

Permalink
chore(settings/integration): teams product analytics KMCNG-2601
Browse files Browse the repository at this point in the history
  • Loading branch information
amirch1 committed Apr 8, 2024
1 parent b889b16 commit a4da5a4
Show file tree
Hide file tree
Showing 8 changed files with 105 additions and 25 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@
suggestionSelectableField="isSelectable"
[allowMultiple]="true"
[minLength]="3"
(change)="sendCategoryAnalytics()"
[suggestionsProvider]="_categoriesProvider"
(completeMethod)="_searchCategories($event)">
</kAutoComplete>
Expand All @@ -77,14 +78,17 @@
<p-radioButton name="upload"
[value]="0"
formControlName="upload"
(onClick)="sendUploadAnalytics('all')"
[label]="'applications.settings.integrationSettings.zoom.uploadAll' | translate"></p-radioButton>
<p-radioButton name="upload"
[value]="1"
formControlName="upload"
(onClick)="sendUploadAnalytics('opt_in')"
[label]="'applications.settings.integrationSettings.zoom.uploadIn' | translate"></p-radioButton>
<p-radioButton name="upload"
[value]="2"
formControlName="upload"
(onClick)="sendUploadAnalytics('opt_out')"
[label]="'applications.settings.integrationSettings.zoom.uploadOut' | translate"></p-radioButton>
</div>

Expand Down Expand Up @@ -124,7 +128,7 @@
<div class="kLabel">
<span>{{'applications.settings.integrationSettings.teams.transcripts' | translate}}</span>
</div>
<p-inputSwitch class="kControl" formControlName="transcripts"></p-inputSwitch>
<p-inputSwitch class="kControl" formControlName="transcripts" (onChange)="sendTranscriptAnalytics()"></p-inputSwitch>
<span class="kSwitchValue">
{{_profileForm.get('transcripts').value ? ('app.common.yes' | translate) : ('app.common.no' | translate)}}
</span>
Expand All @@ -136,19 +140,19 @@
<div class="kLabel">
<span>{{'applications.settings.integrationSettings.teams.organizers' | translate}}</span>
</div>
<p-dropdown class="kControl" formControlName="coOrganizerRoles" [options]="_hostsOptions"></p-dropdown>
<p-dropdown class="kControl" formControlName="coOrganizerRoles" [options]="_hostsOptions" (onChange)="sendOrganizersAnalytics()"></p-dropdown>
</div>
<div class="kRow">
<div class="kLabel">
<span>{{'applications.settings.integrationSettings.teams.presenters' | translate}}</span>
</div>
<p-dropdown class="kControl" formControlName="presentersRoles" [options]="_hostsOptions"></p-dropdown>
<p-dropdown class="kControl" formControlName="presentersRoles" [options]="_hostsOptions" (onChange)="sendPresentersAnalytics()"></p-dropdown>
</div>
<div class="kRow">
<div class="kLabel">
<span>{{'applications.settings.integrationSettings.teams.users' | translate}}</span>
</div>
<p-dropdown class="kControl" formControlName="attendeesRoles" [options]="_participationOptions"></p-dropdown>
<p-dropdown class="kControl" formControlName="attendeesRoles" [options]="_participationOptions" (onChange)="sendUsersAnalytics()"></p-dropdown>
</div>

<span class="kSubTitle">{{'applications.settings.integrationSettings.zoom.owner' | translate}}</span>
Expand All @@ -160,6 +164,7 @@
<div class="kRadios">
<p-radioButton name="userId"
[value]="true"
(onClick)="sendOwnerAnalytics('UPN')"
formControlName="userId"
[label]="'applications.settings.integrationSettings.teams.upn' | translate"></p-radioButton>
<div class="kRow" style="margin-left: 36px; margin-bottom: 0px">
Expand All @@ -185,6 +190,7 @@
<div class="kRow" style="align-items: flex-start; margin-bottom: 0px">
<p-radioButton name="userId" [ngStyle]="{'marginRight': '0px'}"
[value]="false"
(onClick)="sendOwnerAnalytics('Azure')"
formControlName="userId"
[label]="'applications.settings.integrationSettings.teams.azure' | translate"></p-radioButton>
<!-- <kInputHelper class="kHelp" trigger="click">-->
Expand All @@ -201,11 +207,13 @@
<div class="kRadios">
<p-radioButton name="createUser"
[value]="true"
(onClick)="sendNoUserAnalytics('create_teams_based')"
formControlName="createUser"
[label]="'applications.settings.integrationSettings.teams.createUser' | translate"></p-radioButton>
<div class="kRow" style="margin-bottom: 0px; margin-top: 12px; align-items: flex-start">
<div class="kRow" style="margin-bottom: 0px; margin-top: 12px; align-items: flex-start; margin-bottom: 24px">
<p-radioButton name="createUser" [ngStyle]="{'marginRight': '8px'}"
[value]="false"
(onClick)="sendNoUserAnalytics('use_default_user')"
formControlName="createUser"
[label]="'applications.settings.integrationSettings.zoom.user2' | translate"></p-radioButton>
<div class="kRadios">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ import { SuggestionsProviderData } from "@kaltura-ng/kaltura-primeng-ui";
import { ISubscription } from "rxjs/Subscription";
import { Observable } from "rxjs";
import { CategoriesSearchService } from "app-shared/content-shared/categories/categories-search.service";
import { BrowserService } from "app-shared/kmc-shell";
import {AppAnalytics, BrowserService, ButtonType, PageType} from 'app-shared/kmc-shell';
import { TeamsIntegration } from '../teams.service';

@Component({
Expand Down Expand Up @@ -64,10 +64,12 @@ export class EditTeamsProfileComponent implements OnDestroy {

constructor(private _appLocalization: AppLocalization,
private _fb: FormBuilder,
private _analytics: AppAnalytics,
private _browserService: BrowserService,
private _kalturaServerClient: KalturaClient,
private _categoriesSearchService: CategoriesSearchService,
private _logger: KalturaLogger) {
this._analytics.trackPageLoadEvent(PageType.Edit, 'Teams_edit_form');
this._participationOptions = [
{value: 0, label: this._appLocalization.get('applications.settings.integrationSettings.teams.users1')},
{value: 2, label: this._appLocalization.get('applications.settings.integrationSettings.zoom.hosts2')},
Expand Down Expand Up @@ -205,6 +207,48 @@ export class EditTeamsProfileComponent implements OnDestroy {
});
}

public sendCategoryAnalytics(): void {
this._analytics.trackButtonClickEvent(ButtonType.Add, 'Teams_add_category');
}

public sendUploadAnalytics(key: string): void {
this._analytics.trackButtonClickEvent(ButtonType.Choose, 'Teams_recording_management', key);
}

public sendOwnerAnalytics(key: string): void {
this._analytics.trackButtonClickEvent(ButtonType.Choose, 'Teams_set_owner', key);
}

public sendNoUserAnalytics(key: string): void {
this._analytics.trackButtonClickEvent(ButtonType.Choose, 'Teams_no_user', key);
}

public sendTranscriptAnalytics(): void {
const key = this._profileForm.controls['transcripts'].value ? 'enable' : 'disable';
this._analytics.trackButtonClickEvent(ButtonType.Toggle, 'Teams_upload_transcripts', key);
}

public sendOrganizersAnalytics(): void {
const selectedOption = this._hostsOptions.find(item => item.value === this._profileForm.controls['coOrganizerRoles'].value);
if (selectedOption) {
this._analytics.trackButtonClickEvent(ButtonType.Choose, 'Teams_assign_co_organizers', selectedOption.label);
}
}

public sendPresentersAnalytics(): void {
const selectedOption = this._hostsOptions.find(item => item.value === this._profileForm.controls['presentersRoles'].value);
if (selectedOption) {
this._analytics.trackButtonClickEvent(ButtonType.Choose, 'Teams_assign_presenters', selectedOption.label);
}
}

public sendUsersAnalytics(): void {
const selectedOption = this._participationOptions.find(item => item.value === this._profileForm.controls['attendeesRoles'].value);
if (selectedOption) {
this._analytics.trackButtonClickEvent(ButtonType.Choose, 'Teams_assign_users', selectedOption.label);
}
}

public openHelpLink(): void {
this._browserService.openLink('https://marketplace.zoom.us/docs/api-reference/zoom-api/users/user');
}
Expand Down Expand Up @@ -307,6 +351,7 @@ export class EditTeamsProfileComponent implements OnDestroy {
};

public openHelp(): void {
this._analytics.trackButtonClickEvent(ButtonType.Browse, 'Teams_guide', 'edit');
this._browserService.openLink('https://knowledge.kaltura.com/help/kaltura-video-integration-with-teams');
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
import { Component, EventEmitter, Input, Output } from '@angular/core';
import { FormBuilder, FormGroup, Validators } from '@angular/forms';
import { AppLocalization } from '@kaltura-ng/mc-shared';
import { AreaBlockerMessage } from '@kaltura-ng/kaltura-ui';
import { PopupWidgetComponent } from '@kaltura-ng/kaltura-ui';
import { KalturaLogger } from '@kaltura-ng/kaltura-logger';
import { tag } from '@kaltura-ng/kaltura-common';
import {Component, EventEmitter, Input, Output} from '@angular/core';
import {FormBuilder, FormGroup, Validators} from '@angular/forms';
import {AppLocalization} from '@kaltura-ng/mc-shared';
import {AreaBlockerMessage, PopupWidgetComponent} from '@kaltura-ng/kaltura-ui';
import {KalturaLogger} from '@kaltura-ng/kaltura-logger';
import {tag} from '@kaltura-ng/kaltura-common';
import {TeamsIntegration, TeamsIntegrationSettings, TeamsService} from '../teams.service';
import {BrowserService} from 'app-shared/kmc-shell';
import {AppAnalytics, BrowserService, ButtonType, PageType} from 'app-shared/kmc-shell';

@Component({
selector: 'kNewTeamsProfile',
Expand All @@ -30,9 +29,11 @@ import {BrowserService} from 'app-shared/kmc-shell';

constructor(private _fb: FormBuilder,
private _logger: KalturaLogger,
private _analytics: AppAnalytics,
private _teamsService: TeamsService,
private _browserService: BrowserService,
private _appLocalization: AppLocalization) {
this._analytics.trackPageLoadEvent(PageType.Create, 'Teams_add_new_modal');
this._buildForm();
}

Expand Down Expand Up @@ -68,7 +69,7 @@ import {BrowserService} from 'app-shared/kmc-shell';
this._logger.info(`abort action, profile has invalid data`);
return;
}

this._analytics.trackButtonClickEvent(ButtonType.Create, 'Teams_create_integration');
this.updateFormStatus('pristine');

const { name, tenantId, appClientId, appClientSecret } = this._newProfileForm.value;
Expand Down Expand Up @@ -121,6 +122,7 @@ import {BrowserService} from 'app-shared/kmc-shell';
}

public openHelp(): void {
this._analytics.trackButtonClickEvent(ButtonType.Browse, 'Teams_guide', 'new');
this._browserService.openLink('https://knowledge.kaltura.com/help/kaltura-video-integration-with-teams');
}
}
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import { Component, EventEmitter, Input, Output, ViewChild } from '@angular/core';
import { Menu } from 'primeng/menu';
import { AreaBlockerMessage } from '@kaltura-ng/kaltura-ui';
import { AppLocalization } from '@kaltura-ng/mc-shared';
import { MenuItem } from 'primeng/api';
import {KalturaWebexAPIIntegrationSetting} from "kaltura-ngx-client";
import {Component, EventEmitter, Input, Output, ViewChild} from '@angular/core';
import {Menu} from 'primeng/menu';
import {AreaBlockerMessage} from '@kaltura-ng/kaltura-ui';
import {AppLocalization} from '@kaltura-ng/mc-shared';
import {MenuItem} from 'primeng/api';
import {TeamsIntegration} from '../teams.service';
import {AppAnalytics, ButtonType} from 'app-shared/kmc-shell';

@Component({
selector: 'kTeamsProfilesTable',
Expand All @@ -21,7 +21,8 @@ export class TeamsProfilesTableComponent {
@Output() onActionSelected = new EventEmitter<{ action: string, profile: TeamsIntegration }>();
@ViewChild('actionsmenu', { static: true }) private actionsMenu: Menu;

constructor(private _appLocalization: AppLocalization) {
constructor(private _appLocalization: AppLocalization,
private _analytics: AppAnalytics,) {
}

public rowTrackBy: Function = (index: number, item: any) => item;
Expand All @@ -38,6 +39,7 @@ export class TeamsProfilesTableComponent {
{
label: this._appLocalization.get('applications.settings.integrationSettings.zoom.edit'),
command: () => {
this._analytics.trackButtonClickEvent(ButtonType.Edit, 'Teams_edit');
this.openEditScreen(profile);
}
}
Expand All @@ -47,6 +49,7 @@ export class TeamsProfilesTableComponent {
this._items.push({
label: this._appLocalization.get('applications.settings.integrationSettings.zoom.disable'),
command: () => {
this._analytics.trackButtonClickEvent(ButtonType.Toggle, 'Teams_disable');
this.onActionSelected.emit({action: 'disable', profile});
}
});
Expand All @@ -55,6 +58,7 @@ export class TeamsProfilesTableComponent {
this._items.push({
label: this._appLocalization.get('applications.settings.integrationSettings.zoom.enable'),
command: () => {
this._analytics.trackButtonClickEvent(ButtonType.Toggle, 'Teams_enable');
this.onActionSelected.emit({action: 'enable', profile});
}
});
Expand All @@ -69,6 +73,7 @@ export class TeamsProfilesTableComponent {
this._items.push({
label: this._appLocalization.get('applications.settings.integrationSettings.teams.download'),
command: () => {
this._analytics.trackButtonClickEvent(ButtonType.Download, 'Teams_download_logs');
this.onActionSelected.emit({action: 'download', profile});
}
});
Expand All @@ -78,6 +83,7 @@ export class TeamsProfilesTableComponent {
label: this._appLocalization.get('applications.settings.authentication.table.delete'),
styleClass: 'kDanger',
command: () => {
this._analytics.trackButtonClickEvent(ButtonType.Delete, 'Teams_delete');
this.onActionSelected.emit({action: 'delete', profile});
}
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<span>{{'applications.settings.integrationSettings.teams.title' | translate}}</span>
</div>
<div class="kGenerateCode">
<button type="button" class="kButtonDefault" (click)="newIntergationPopup.open()" pButton
<button type="button" class="kButtonDefault" (click)="trackAnalytics();newIntergationPopup.open()" pButton
label="{{'applications.settings.integrationSettings.teams.add' | translate}}"></button>
</div>
<div class="kExplanation">{{'applications.settings.integrationSettings.teams.subTitle' | translate}}</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import {LoadTeamsIntegrationResponse, TeamsIntegration, TeamsService} from './te
import {AreaBlockerMessage} from '@kaltura-ng/kaltura-ui';
import {AppLocalization} from '@kaltura-ng/mc-shared';
import {PopupWidgetComponent} from '@kaltura-ng/kaltura-ui';
import {BrowserService} from 'app-shared/kmc-shell';
import {AppAnalytics, BrowserService, ButtonType} from 'app-shared/kmc-shell';
import {KMCPermissions} from 'app-shared/kmc-shared/kmc-permissions';
import {KalturaLogger} from '@kaltura-ng/kaltura-logger';
import {SettingsIntegrationSettingsMainViewService} from 'app-shared/kmc-shared/kmc-views';
Expand Down Expand Up @@ -33,6 +33,7 @@ export class TeamsComponent implements OnInit, OnDestroy {

constructor(private _appLocalization: AppLocalization,
private _logger: KalturaLogger,
private _analytics: AppAnalytics,
private _teamsService: TeamsService,
private _browserService: BrowserService,
private _settingsIntegrationSettingsMainView: SettingsIntegrationSettingsMainViewService) {
Expand Down Expand Up @@ -227,6 +228,10 @@ export class TeamsComponent implements OnInit, OnDestroy {
this._browserService.showToastMessage({severity: 'success', detail: this._appLocalization.get('applications.settings.integrationSettings.teams.secretSuccess')});
}

public trackAnalytics(): void {
this._analytics.trackButtonClickEvent(ButtonType.Add, 'Teams_initiate_new_integration');
}

private _updateAreaBlockerState(isBusy: boolean, areaBlocker: AreaBlockerMessage): void {
this._logger.debug(`update areablocker state`, {isBusy, message: areaBlocker ? areaBlocker.message : null});
this._isBusy = isBusy;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import { PopupWidgetComponent } from '@kaltura-ng/kaltura-ui';
import { KalturaLogger } from '@kaltura-ng/kaltura-logger';
import { tag } from '@kaltura-ng/kaltura-common';
import {TeamsIntegration, TeamsService} from '../teams.service';
import {AppAnalytics, ButtonType, PageType} from 'app-shared/kmc-shell';

@Component({
selector: 'kUpdateProfileSecret',
Expand All @@ -28,9 +29,11 @@ import {TeamsIntegration, TeamsService} from '../teams.service';
}

constructor(private _fb: FormBuilder,
private _analytics: AppAnalytics,
private _logger: KalturaLogger,
private _teamsService: TeamsService,
private _appLocalization: AppLocalization) {
this._analytics.trackPageLoadEvent(PageType.Edit, 'Teams_update_secret_modal');
this._buildForm();
}

Expand Down Expand Up @@ -63,7 +66,7 @@ import {TeamsIntegration, TeamsService} from '../teams.service';
this._logger.info(`abort action, profile has invalid data`);
return;
}

this._analytics.trackButtonClickEvent(ButtonType.Save, 'Teams_update_secret');
this.updateFormStatus('pristine');

const { appClientSecret } = this._profileForm.value;
Expand Down
11 changes: 11 additions & 0 deletions src/shared/kmc-shell/providers/app-analytics.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,9 @@ export class AppAnalytics {
case '/settings/authentication/list':
this.trackEvent(EventType.PageLoad, PageType.List, 'KMC_authentication_profiles');
break;
case '/settings/integrationSettings':
this.trackEvent(EventType.PageLoad, PageType.List, 'KMC_settings_integration');
break;
}
});
}
Expand Down Expand Up @@ -231,6 +234,14 @@ export class AppAnalytics {
}
}

public trackPageLoadEvent(type: PageType, name: string): void {
this.trackEvent(EventType.PageLoad, type, name);
}

public trackButtonClickEvent(type: ButtonType, name: string, value: string = null): void {
this.trackEvent(EventType.ButtonClicked, type, name, value);
}

private trackEvent(eventType: EventType, eventVar1: ButtonType | PageType, eventVar2: string, eventVar3: string = null): void {
if (!this._enabled) {
return;
Expand Down

0 comments on commit a4da5a4

Please sign in to comment.