mirror of
https://github.com/scratchfoundation/scratchx.git
synced 2024-11-25 00:58:05 -05:00
Track extensions loaded
This commit is contained in:
parent
0f66f238e3
commit
dba9d08dc8
1 changed files with 15 additions and 5 deletions
|
@ -130,12 +130,12 @@ function sendFileToFlash(file) {
|
|||
fileReader.onload = function (e) {
|
||||
var fileAsB64 = ab_to_b64(fileReader.result);
|
||||
if (Scratch.FlashApp.ASobj.ASloadBase64SBX !== undefined) {
|
||||
$(document).trigger("editor:extensionLoaded");
|
||||
$(document).trigger("editor:extensionLoaded", {method: "file"});
|
||||
showPage(editorId);
|
||||
Scratch.FlashApp.ASobj.ASloadBase64SBX(fileAsB64);
|
||||
} else {
|
||||
$(document).on("editor:ready", function(e) {
|
||||
$(document).trigger("editor:extensionLoaded");
|
||||
$(document).trigger("editor:extensionLoaded", {method: "file"});
|
||||
showPage(editorId);
|
||||
Scratch.FlashApp.ASobj.ASloadBase64SBX(fileAsB64);
|
||||
$(this).off(e);
|
||||
|
@ -157,11 +157,11 @@ function sendURLtoFlash() {
|
|||
}
|
||||
if (urls.length <= 0) return;
|
||||
if (Scratch.FlashApp.ASobj.ASloadGithubURL !== undefined) {
|
||||
$(document).trigger("editor:extensionLoaded");
|
||||
$(document).trigger("editor:extensionLoaded", {method: "url", urls: urls});
|
||||
Scratch.FlashApp.ASobj.ASloadGithubURL(urls);
|
||||
} else {
|
||||
$(document).on("editor:ready", function(e) {
|
||||
$(document).trigger("editor:extensionLoaded");
|
||||
$(document).trigger("editor:extensionLoaded", {method: "url", urls: urls});
|
||||
Scratch.FlashApp.ASobj.ASloadGithubURL(urls);
|
||||
$(this).off(e);
|
||||
});
|
||||
|
@ -190,7 +190,6 @@ function loadFromURLParameter(queryString) {
|
|||
if (urls.length > 0) sendURLtoFlash.apply(window, urls);
|
||||
}
|
||||
|
||||
|
||||
/* Modals */
|
||||
|
||||
function getOrCreateFromTemplate(elementId, templateId, elementType, appendTo, wrapper, data) {
|
||||
|
@ -421,6 +420,17 @@ $(document).on("page:show", function(e, page){
|
|||
ga("send", "pageview", page);
|
||||
ga("set", "referrer", document.location.origin + document.location.pathname + document.location.hash)
|
||||
});
|
||||
|
||||
$(document).on("editor:extensionLoaded", function(e, data){
|
||||
if (data.method == "url") {
|
||||
for (var i = 0; url = data['urls'][i]; i++) {
|
||||
ga("send", "event", "extensionLoaded", data.method, url);
|
||||
}
|
||||
} else {
|
||||
ga("send", "event", "extensionLoaded", data.method);
|
||||
}
|
||||
});
|
||||
|
||||
function initPage() {
|
||||
/*
|
||||
On load, show the page identified by the URL fragment. Default to #home.
|
||||
|
|
Loading…
Reference in a new issue