From 537fd22bb5bca3b26ab0eda189bf9347e239484f Mon Sep 17 00:00:00 2001 From: Allan Date: Thu, 17 Aug 2023 12:17:41 -0700 Subject: [PATCH] Add click tracking of install copy command to help verify downloads (#420) --- _includes/selector.html | 27 +++++++++++++++++++++++++-- 1 file changed, 25 insertions(+), 2 deletions(-) diff --git a/_includes/selector.html b/_includes/selector.html index 8e42b52e98d..7618882fa1e 100644 --- a/_includes/selector.html +++ b/_includes/selector.html @@ -343,7 +343,7 @@
Command
-
+
@@ -747,13 +747,36 @@ if (this.active_additional_packages.includes("TensorFlow") && this.active_cuda_ver !== "11.2") this.active_cuda_ver = "11.2"; }, copyToClipboard() { - var range = document.createRange(); + let range = document.createRange(); range.selectNode(this.$refs.cmd); window.getSelection().removeAllRanges(); window.getSelection().addRange(range); + let text = window.getSelection().toString() document.execCommand("copy"); window.getSelection().removeAllRanges(); + + /** checks number of installs from copy command vs downloads **/ + gtag('event', 'copyClick', { + 'button': 'CopyCommand', + 'install_copy_cmd': text + }); }, + copyToGA(){ + let range = document.createRange(); + range.selectNode(this.$refs.cmd); + window.getSelection().removeAllRanges(); + window.getSelection().addRange(range); + let text = window.getSelection().toString() + document.execCommand("copy"); + window.getSelection().removeAllRanges(); + + /** checks number of installs from copy vs downloads **/ + /** Note mouse-up event is only sent once **/ + gtag('event', 'copyMouseUp', { + 'button': 'CopyCommand', + 'install_copy_cmd': text + }); + } })) })