File tree Expand file tree Collapse file tree 1 file changed +13
-2
lines changed Expand file tree Collapse file tree 1 file changed +13
-2
lines changed Original file line number Diff line number Diff line change @@ -46,7 +46,8 @@ export function sendEvent ({
46
46
survey_email,
47
47
experiment_name,
48
48
experiment_variation,
49
- experiment_success
49
+ experiment_success,
50
+ clipboard_operation
50
51
} ) {
51
52
const body = {
52
53
_csrf : getCsrf ( ) ,
@@ -107,7 +108,10 @@ export function sendEvent ({
107
108
// Experiment event
108
109
experiment_name,
109
110
experiment_variation,
110
- experiment_success
111
+ experiment_success,
112
+
113
+ // Clipboard event
114
+ clipboard_operation
111
115
}
112
116
const blob = new Blob ( [ JSON . stringify ( body ) ] , { type : 'application/json' } )
113
117
navigator . sendBeacon ( '/events' , blob )
@@ -170,6 +174,13 @@ export default function initializeEvents () {
170
174
page_render_duration : render
171
175
} )
172
176
177
+ // Clipboard event
178
+ ; [ 'copy' , 'cut' , 'paste' ] . forEach ( verb => {
179
+ document . documentElement . addEventListener ( verb , ( ) => {
180
+ sendEvent ( { type : 'clipboard' , clipboard_operation : verb } )
181
+ } )
182
+ } )
183
+
173
184
// Link event
174
185
document . documentElement . addEventListener ( 'click' , evt => {
175
186
const link = evt . target . closest ( 'a[href^="http"]' )
You can’t perform that action at this time.
0 commit comments