File tree Expand file tree Collapse file tree 2 files changed +12
-7
lines changed
src/services/events/amplitude Expand file tree Collapse file tree 2 files changed +12
-7
lines changed Original file line number Diff line number Diff line change @@ -73,13 +73,16 @@ describe('pageViewTrackingSanitization', () => {
73
73
event_properties : {
74
74
'[Amplitude] Page Counter' : 1 ,
75
75
'[Amplitude] Page Domain' : 'app.codecov.io' ,
76
+ '[Amplitude] Page Title' : 'Codecov' ,
76
77
'[Amplitude] Page Path' : '/sensitive/info' ,
77
78
'[Amplitude] Page Location' : 'https://app.codecov.io/sensitive/info' ,
79
+ '[Amplitude] Page URL' : 'https://app.codecov.io/sensitive/info' ,
78
80
} ,
79
81
} as Event )
80
82
expect ( event ?. event_properties ) . toMatchObject ( {
81
83
'[Amplitude] Page Counter' : 1 ,
82
84
'[Amplitude] Page Domain' : 'app.codecov.io' ,
85
+ '[Amplitude] Page Title' : 'Codecov' ,
83
86
path : undefined ,
84
87
} )
85
88
}
Original file line number Diff line number Diff line change @@ -14,14 +14,16 @@ export const pageViewTrackingSanitization = (): EnrichmentPlugin => {
14
14
type : 'enrichment' ,
15
15
setup : async ( ) => undefined ,
16
16
execute : async ( event ) => {
17
+ /* eslint-disable camelcase */
17
18
if ( event . event_type === '[Amplitude] Page Viewed' ) {
18
- /* eslint-disable camelcase */
19
- event . event_properties = {
20
- '[Amplitude] Page Counter' :
21
- event . event_properties ?. [ '[Amplitude] Page Counter' ] ,
22
- '[Amplitude] Page Domain' :
23
- event . event_properties ?. [ '[Amplitude] Page Domain' ] ,
24
- path : eventTracker ( ) . context . path ,
19
+ if ( event . event_properties ) {
20
+ // Remove any information containing names and/or ids.
21
+ delete event . event_properties [ '[Amplitude] Page Location' ] // location.href
22
+ delete event . event_properties [ '[Amplitude] Page Path' ] // Full path of current page
23
+ delete event . event_properties [ '[Amplitude] Page URL' ] // Full URL of current page
24
+ delete event . event_properties . referrer // Full URL of previous page
25
+
26
+ event . event_properties . path = eventTracker ( ) . context . path // Add the React path match
25
27
}
26
28
}
27
29
You can’t perform that action at this time.
0 commit comments