From a9863b90820930f0b8aaffbdf4ef294397efb6b3 Mon Sep 17 00:00:00 2001 From: Liam Cardenas Date: Mon, 18 Dec 2017 22:34:03 -0800 Subject: [PATCH] Improve click analytics --- src/renderer/component/header/view.jsx | 1 + src/renderer/index.js | 4 +++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/src/renderer/component/header/view.jsx b/src/renderer/component/header/view.jsx index 1e83abbe7..b3b6cdc51 100644 --- a/src/renderer/component/header/view.jsx +++ b/src/renderer/component/header/view.jsx @@ -46,6 +46,7 @@ export const Header = props => { onClick={() => navigate("/subscriptions")} button="alt button--flat" icon="icon-at" + title={__("My Subscriptions")} />
diff --git a/src/renderer/index.js b/src/renderer/index.js index d5154b084..e3ed7836b 100644 --- a/src/renderer/index.js +++ b/src/renderer/index.js @@ -73,7 +73,8 @@ document.addEventListener("click", event => { if (target.matches("a") || target.matches("button")) { // TODO: Look into using accessiblity labels (this would also make the app more accessible) let hrefParts = window.location.href.split("#"); - let element = target.title || (target.text && target.text.trim()); + let element = + target.title || (target.textContent && target.textContent.trim()); if (element) { amplitude.getInstance().logEvent("CLICK", { target: element, @@ -84,6 +85,7 @@ document.addEventListener("click", event => { amplitude.getInstance().logEvent("UNMARKED_CLICK", { location: hrefParts.length > 1 ? hrefParts[hrefParts.length - 1] : "/", + source: target.outerHTML, }); } }