File tree Expand file tree Collapse file tree 2 files changed +15
-2
lines changed
src/library/user-analytics Expand file tree Collapse file tree 2 files changed +15
-2
lines changed Original file line number Diff line number Diff line change @@ -33,7 +33,8 @@ export namespace UserInteraction {
3333 export const TYPE = "UserInteraction" ;
3434
3535 export type Action =
36- | "onClick" ;
36+ | "onClick"
37+ | "onChange"
3738
3839 export interface Tracker {
3940 action : Action ;
Original file line number Diff line number Diff line change @@ -28,6 +28,7 @@ export function withTracking (
2828 tracker : UserInteraction . Tracker ,
2929 ) {
3030 const targetNode = e . target as HTMLElement ;
31+ const value = getValueFromNode ( e ) ;
3132 const userInteractionResource = UserInteraction . generateResource (
3233 dataContext . app ,
3334 tracker . action ,
@@ -40,7 +41,9 @@ export function withTracking (
4041 target : targetNode . nodeName || e . currentTarget . nodeName ,
4142 innerHTML : targetNode . innerHTML ,
4243 innerText : targetNode . innerText ,
43- value : "" ,
44+ ...( value && {
45+ value,
46+ } ) ,
4447 } ,
4548 } ,
4649 tracker . data ,
@@ -66,3 +69,12 @@ export function withTracking (
6669 ) ;
6770 } ;
6871} ;
72+
73+ function getValueFromNode ( e : React . SyntheticEvent ) {
74+
75+ if ( e . currentTarget . nodeName === "INPUT" ) {
76+ const currentTarget = e . target as HTMLInputElement ;
77+ return currentTarget . value
78+ }
79+ }
80+
You can’t perform that action at this time.
0 commit comments