File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -46,7 +46,8 @@ export function sendEvent ({
4646 survey_email,
4747 experiment_name,
4848 experiment_variation,
49- experiment_success
49+ experiment_success,
50+ clipboard_operation
5051} ) {
5152 const body = {
5253 _csrf : getCsrf ( ) ,
@@ -107,7 +108,10 @@ export function sendEvent ({
107108 // Experiment event
108109 experiment_name,
109110 experiment_variation,
110- experiment_success
111+ experiment_success,
112+
113+ // Clipboard event
114+ clipboard_operation
111115 }
112116 const blob = new Blob ( [ JSON . stringify ( body ) ] , { type : 'application/json' } )
113117 navigator . sendBeacon ( '/events' , blob )
@@ -170,6 +174,13 @@ export default function initializeEvents () {
170174 page_render_duration : render
171175 } )
172176
177+ // Clipboard event
178+ ; [ 'copy' , 'cut' , 'paste' ] . forEach ( verb => {
179+ document . documentElement . addEventListener ( verb , ( ) => {
180+ sendEvent ( { type : 'clipboard' , clipboard_operation : verb } )
181+ } )
182+ } )
183+
173184 // Link event
174185 document . documentElement . addEventListener ( 'click' , evt => {
175186 const link = evt . target . closest ( 'a[href^="http"]' )
You can’t perform that action at this time.
0 commit comments