1
1
import { Injectable } from '@angular/core' ;
2
- import { BusinessCentralOnboardingState , BusinessCentralUpdateEvent , ClickEvent , IntacctOnboardingState , IntacctUpdateEvent , Page , QBDOnboardingState , Sage300OnboardingState , Sage300UpdateEvent , UpdateEvent } from '../../models/enum/enum.model' ;
2
+ import { BusinessCentralOnboardingState , BusinessCentralUpdateEvent , ClickEvent , IntacctOnboardingState , IntacctUpdateEvent , Page , QBDOnboardingState , Sage300OnboardingState , Sage300UpdateEvent , TrackingApp , UpdateEvent } from '../../models/enum/enum.model' ;
3
3
import { MappingAlphabeticalFilterAdditionalProperty , ResolveMappingErrorProperty , UpdateEventAdditionalProperty , UpdateIntacctEventAdditionalProperty } from '../../models/misc/tracking.model' ;
4
4
import { QBDAdvancedSettingsPost } from '../../models/qbd/qbd-configuration/advanced-setting.model' ;
5
5
import { QBDExportSettingPost } from '../../models/qbd/qbd-configuration/export-setting.model' ;
@@ -52,14 +52,14 @@ export class TrackingService {
52
52
return ( window as any ) . analytics ;
53
53
}
54
54
55
- eventTrack ( action : string , properties : any = { } ) : void {
55
+ eventTrack ( action : string , trackingApp ?: TrackingApp , properties : any = { } ) : void {
56
56
const flattenedObject = this . flattenObject ( properties ) ;
57
57
properties = {
58
58
...flattenedObject ,
59
59
Asset : 'Integration Settings Web'
60
60
} ;
61
61
if ( this . tracking ) {
62
- this . tracking . track ( action , properties ) ;
62
+ this . tracking . track ( ` ${ trackingApp ? trackingApp : 'Integration Settings Web' } : ${ action } ` , properties ) ;
63
63
}
64
64
}
65
65
@@ -75,44 +75,40 @@ export class TrackingService {
75
75
this . eventTrack ( 'Opened Landing Page' ) ;
76
76
}
77
77
78
- onClickEvent ( eventName : ClickEvent ) : void {
79
- this . eventTrack ( `Click event: ${ eventName } ` ) ;
78
+ onClickEvent ( trackingApp : TrackingApp , eventName : ClickEvent ) : void {
79
+ this . eventTrack ( `Click event: ${ eventName } ` , trackingApp , { } ) ;
80
80
}
81
81
82
- onErrorPage ( ) : void {
83
- this . eventTrack ( 'Error Page shown' ) ;
84
- }
85
-
86
- trackTimeSpent ( page : Page , sessionStartTime : Date ) : void {
82
+ trackTimeSpent ( trackingApp : TrackingApp , page : Page , sessionStartTime : Date ) : void {
87
83
const differenceInMs = new Date ( ) . getTime ( ) - sessionStartTime . getTime ( ) ;
88
- this . eventTrack ( `Time Spent on ${ page } page` , { durationInSeconds : differenceInMs / 1000 } ) ;
84
+ this . eventTrack ( `Time Spent on ${ page } page` , trackingApp , { durationInSeconds : differenceInMs / 1000 } ) ;
89
85
}
90
86
91
- onOnboardingStepCompletion ( eventName : QBDOnboardingState | Sage300OnboardingState | BusinessCentralOnboardingState , stepNumber : number , additionalProperties : QBDExportSettingPost | QBDFieldMappingPost | QBDAdvancedSettingsPost | void | Sage300ExportSettingPost | Sage300ImportSettingPost | Sage300AdvancedSettingPost | BusinessCentralExportSettingPost | BusinessCentralImportSettingsPost | BusinessCentralAdvancedSettingsPost ) : void {
92
- this . eventTrack ( `Step ${ stepNumber } completed: ${ eventName } ` , additionalProperties ) ;
87
+ onOnboardingStepCompletion ( trackingApp : TrackingApp , eventName : QBDOnboardingState | Sage300OnboardingState | BusinessCentralOnboardingState , stepNumber : number , additionalProperties : QBDExportSettingPost | QBDFieldMappingPost | QBDAdvancedSettingsPost | void | Sage300ExportSettingPost | Sage300ImportSettingPost | Sage300AdvancedSettingPost | BusinessCentralExportSettingPost | BusinessCentralImportSettingsPost | BusinessCentralAdvancedSettingsPost ) : void {
88
+ this . eventTrack ( `Step ${ stepNumber } completed: ${ eventName } ` , trackingApp , additionalProperties ) ;
93
89
}
94
90
95
- integrationsOnboardingCompletion ( eventName : IntacctOnboardingState , stepNumber : number , additionalProperties : LocationEntityPost | ExportSettingPost | ImportSettingPost | AdvancedSettingsPost | void ) : void {
96
- this . eventTrack ( `Step ${ stepNumber } completed: ${ eventName } ` , additionalProperties ) ;
91
+ integrationsOnboardingCompletion ( trackingApp : TrackingApp , eventName : IntacctOnboardingState , stepNumber : number , additionalProperties : LocationEntityPost | ExportSettingPost | ImportSettingPost | AdvancedSettingsPost | void ) : void {
92
+ this . eventTrack ( `Step ${ stepNumber } completed: ${ eventName } ` , trackingApp , additionalProperties ) ;
97
93
}
98
94
99
- onUpdateEvent ( eventName : UpdateEvent | Sage300UpdateEvent | BusinessCentralUpdateEvent , additionalProperties : Partial < UpdateEventAdditionalProperty > | void ) : void {
100
- this . eventTrack ( `Update event: ${ eventName } ` , additionalProperties ) ;
95
+ onUpdateEvent ( trackingApp : TrackingApp , eventName : UpdateEvent | Sage300UpdateEvent | BusinessCentralUpdateEvent , additionalProperties : Partial < UpdateEventAdditionalProperty > | void ) : void {
96
+ this . eventTrack ( `Update event: ${ eventName } ` , trackingApp , additionalProperties ) ;
101
97
}
102
98
103
99
intacctUpdateEvent ( eventName : IntacctUpdateEvent , additionalProperties : Partial < UpdateIntacctEventAdditionalProperty > | void ) : void {
104
- this . eventTrack ( `Update event: ${ eventName } ` , additionalProperties ) ;
100
+ this . eventTrack ( `Update event: ${ eventName } ` , TrackingApp . INTACCT , additionalProperties ) ;
105
101
}
106
102
107
- onDateFilter ( properties : { filterType : 'existing' | 'custom' , startDate : Date , endDate : Date } ) : void {
108
- this . eventTrack ( 'Date filter' , properties ) ;
103
+ onDateFilter ( trackingApp : TrackingApp , properties : { filterType : 'existing' | 'custom' , startDate : Date , endDate : Date } ) : void {
104
+ this . eventTrack ( 'Date filter' , trackingApp , properties ) ;
109
105
}
110
106
111
- onMappingsAlphabeticalFilter ( properties : MappingAlphabeticalFilterAdditionalProperty ) : void {
112
- this . eventTrack ( 'Mappings Alphabetical Filter' , properties ) ;
107
+ onMappingsAlphabeticalFilter ( trackingApp : TrackingApp , properties : MappingAlphabeticalFilterAdditionalProperty ) : void {
108
+ this . eventTrack ( 'Mappings Alphabetical Filter' , trackingApp , properties ) ;
113
109
}
114
110
115
- onErrorResolve ( properties : ResolveMappingErrorProperty ) : void {
116
- this . eventTrack ( 'Resolve Mapping Error' , properties ) ;
111
+ onErrorResolve ( trackingApp : TrackingApp , properties : ResolveMappingErrorProperty ) : void {
112
+ this . eventTrack ( 'Resolve Mapping Error' , trackingApp , properties ) ;
117
113
}
118
114
}
0 commit comments