log more events to analytics

This commit is contained in:
Ben Wheeler 2020-04-13 22:09:20 -04:00
parent 9e30b90a17
commit caa7aed291
6 changed files with 19 additions and 2 deletions

View file

@ -536,6 +536,7 @@ export default class ScratchJr {
inFullscreen = false;
UI.quitFullScreen();
onBackButtonCallback.pop();
iOS.analyticsEvent('editor', 'full_screen_exited');
document.body.style.background = 'white';
}

View file

@ -716,6 +716,7 @@ export default class Sprite {
var sprites = JSON.parse(page.sprites);
sprites.push(this.id);
page.sprites = JSON.stringify(sprites);
iOS.analyticsEvent('editor', 'text_sprite_create');
if ((this.str == '') && !whenDone) {
this.setTextBox();
this.activateInput();
@ -805,6 +806,7 @@ export default class Sprite {
document.body.scrollLeft = 0;
var form = document.forms.activetextbox;
var changed = (this.oldvalue != form.typing.value);
iOS.analyticsEvent('editor', 'text_sprite_close');
if (this.noChars(form.typing.value)) {
this.deleteText(this.oldvalue != '');
} else {
@ -889,6 +891,7 @@ export default class Sprite {
var ti = document.forms.activetextbox.typing;
gn('textbox').style.visibility = 'visible';
var me = this;
iOS.analyticsEvent('editor', 'text_sprite_open');
ti.onblur = function () {
me.unfocusText();
};

View file

@ -60,6 +60,7 @@ export default class Record {
// Dialog box hide/show
static appear () {
iOS.analyticsEvent('editor', 'record_dialog_open');
gn('backdrop').setAttribute('class', 'modal-backdrop fade in');
setProps(gn('backdrop').style, {
display: 'block'
@ -71,6 +72,7 @@ export default class Record {
}
static disappear () {
iOS.analyticsEvent('editor', 'record_dialog_close');
setTimeout(function () {
gn('backdrop').setAttribute('class', 'modal-backdrop fade');
setProps(gn('backdrop').style, {
@ -152,6 +154,7 @@ export default class Record {
}
static startRecording (filename) {
iOS.analyticsEvent('editor', 'start_recording');
if (parseInt(filename) < 0) {
// Error in getting record filename - go back to editor
recordedSound = undefined;
@ -250,6 +253,7 @@ export default class Record {
// Stop the volume monitor and recording
static stopRecording (fcn) {
iOS.analyticsEvent('editor', 'stop_recording');
if (timeLimit != null) {
clearTimeout(timeLimit);
timeLimit = null;

View file

@ -8,6 +8,7 @@ import Page from '../engine/Page';
import ScriptsPane from './ScriptsPane';
import Undo from './Undo';
import UI from './UI';
import iOS from '../../iPad/iOS';
import Events from '../../utils/Events';
import ScratchAudio from '../../utils/ScratchAudio';
import {frame, gn, localx, newHTML, scaleMultiplier, getIdFor,
@ -82,6 +83,7 @@ export default class Thumbs {
var tb = Thumbs.getType(Thumbs.t, 'pagethumb');
if (ScratchJr.shaking && (e.target.className == 'deletethumb')) {
ScratchJr.clearSelection();
iOS.analyticsEvent('editor', 'delete_scene');
ScratchJr.stage.deletePage(tb.owner);
return;
}
@ -376,6 +378,7 @@ export default class Thumbs {
sc.owner.deactivate();
}
ScratchJr.unfocus(e);
iOS.analyticsEvent('editor', 'add_scene');
new Page(getIdFor('page'));
}

View file

@ -761,6 +761,7 @@ export default class UI {
static toggleGrid (b) {
Grid.hide(b);
iOS.analyticsEvent('editor', Grid.hidden ? 'hide_grid' : 'show_grid');
gn('grid').className = Grid.hidden ? 'gridToggle off' : 'gridToggle on';
}

View file

@ -164,8 +164,12 @@ export default class Paint {
let action = '';
let label = '';
// Analytics:
// md3: name of the asset, an md5 hash for user generated, filename for library items
// sname: is not set for a new character (ignored for backgrounds)
// * md3: name of the asset, an md5 hash for user generated, filename for library items
// * sname: is not set for a new character (ignored for backgrounds)
// log two events:
// * paint editor is opened
// * type of edit (edit_background, edit_character, new_character)
iOS.analyticsEvent('paint_editor', 'paint_editor_open');
if (bkg) {
action = 'edit_background';
label = (md5 in MediaLib.keys) ? md5 : 'user_background';
@ -352,6 +356,7 @@ export default class Paint {
}
static close () {
iOS.analyticsEvent('paint_editor', 'paint_editor_close');
saving = true;
paintFrame.className = 'paintframe disappear';
frame.style.display = 'block';