Skip to content
This repository has been archived by the owner on Jan 16, 2021. It is now read-only.

analytics: measure usage of keyboard shortcuts and other features #649

Open
broady opened this issue Sep 25, 2019 · 1 comment
Open

analytics: measure usage of keyboard shortcuts and other features #649

broady opened this issue Sep 25, 2019 · 1 comment

Comments

@broady
Copy link
Contributor

broady commented Sep 25, 2019

Trigger an event when keyboard shortcuts are used:

https://developers.google.com/analytics/devguides/collection/gajs/methods/gaJSApiEventTracking

Probably here:

if (combo) {
switch (prevCh + ch) {
case "gg":
$('html,body').animate({scrollTop: 0},'fast');
return false;
case "gb":
$('html,body').animate({scrollTop: $(document).height()},'fast');
return false;
case "gi":
if ($('#pkg-index').length > 0) {
$('html,body').animate({scrollTop: $("#pkg-index").offset().top},'fast');
return false;
}
case "ge":
if ($('#pkg-examples').length > 0) {
$('html,body').animate({scrollTop: $("#pkg-examples").offset().top},'fast');
return false;
}
}
}
switch (ch) {
case "/":
$('#x-search-query').focus();
return false;
case "?":
$('#x-shortcuts').modal();
return false;
case "f":
if ($('#x-jump').length > 0) {
$('#x-jump').modal();
return false;
}
}

@broady
Copy link
Contributor Author

broady commented Sep 25, 2019

To collect stats via GA on clicking through to source, it looks like upgrading to analytics.js might be required. I don't think the legacy ga.js gives you a callback after the event was tracked.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

1 participant