mirror of https://github.com/zulip/zulip.git
Send mixpanel events on window resize and page load about the window size
(imported from commit 9c2859513af52510802da4eb94496d54625775f2)
This commit is contained in:
parent
c9bf69189a
commit
22a6cd3dd7
|
@ -10,13 +10,19 @@ if (! enable_metrics()) {
|
|||
mixpanel.disable();
|
||||
}
|
||||
|
||||
mixpanel.register({user: page_params.email, realm: page_params.domain});
|
||||
|
||||
function include_in_sample() {
|
||||
// Send a random sample of events that we generate
|
||||
return Math.random() < 0.1;
|
||||
}
|
||||
|
||||
function send_resize_event() {
|
||||
mixpanel.track('window resized', {height: $(window).height(),
|
||||
width: $(window).width()});
|
||||
}
|
||||
|
||||
mixpanel.register({user: page_params.email, realm: page_params.domain});
|
||||
send_resize_event();
|
||||
|
||||
$(function () {
|
||||
$(document).on('compose_started.zephyr', function (event) {
|
||||
if (! include_in_sample()) {
|
||||
|
@ -57,6 +63,8 @@ $(function () {
|
|||
}
|
||||
});
|
||||
});
|
||||
|
||||
$(window).on('resize', $.debounce(3000, send_resize_event));
|
||||
});
|
||||
|
||||
return exports;
|
||||
|
|
Loading…
Reference in New Issue