1
0
mirror of https://github.com/sehugg/8bitworkshop.git synced 2024-11-26 10:49:17 +00:00

moved ga() pageview to after loading platform

This commit is contained in:
Steven Hugg 2019-08-19 09:43:48 -04:00
parent a216997bd6
commit b3fa4cb2ba
2 changed files with 10 additions and 3 deletions

View File

@ -28,7 +28,6 @@ window.ga=window.ga||function(){(ga.q=ga.q||[]).push(arguments)};ga.l=+new Date;
if (window.location.host.endsWith('8bitworkshop.com')) { if (window.location.host.endsWith('8bitworkshop.com')) {
ga('create', 'UA-54497476-9', 'auto'); ga('create', 'UA-54497476-9', 'auto');
ga('set', 'anonymizeIp', true); ga('set', 'anonymizeIp', true);
ga('send', 'pageview');
} }
</script> </script>
<script async src='https://www.google-analytics.com/analytics.js'></script> <script async src='https://www.google-analytics.com/analytics.js'></script>

View File

@ -76,8 +76,11 @@ var TOOL_TO_SOURCE_STYLE = {
'xasm6809': 'z80' 'xasm6809': 'z80'
} }
function gaEvent(category:string, action:string, label?:string, value?:string) {
if (ga) ga('send', 'event', category, action, label, value);
}
function alertError(s:string) { function alertError(s:string) {
if (ga) ga('send', 'event', 'error', 'error', s); gaEvent('error', 'error', s);
setWaitDialog(false); setWaitDialog(false);
bootbox.alert(s); bootbox.alert(s);
} }
@ -318,6 +321,7 @@ function _createNewFile(e) {
filename += platform.getDefaultExtension(); filename += platform.getDefaultExtension();
} }
var path = filename; var path = filename;
gaEvent('workspace', 'file', 'new');
reloadProject(path); reloadProject(path);
} }
} }
@ -342,6 +346,7 @@ function handleFileUpload(files: File[]) {
} else { } else {
updateSelector(); updateSelector();
alertInfo("Files uploaded."); alertInfo("Files uploaded.");
gaEvent('workspace', 'file', 'upload');
} }
} else { } else {
var path = f.name; var path = f.name;
@ -444,6 +449,7 @@ function importProjectFromGithub(githuburl:string, replaceURL:boolean) {
// reload repo // reload repo
qs = {repo:sess.repopath}; // file:sess.mainPath, platform:sess.platform_id}; qs = {repo:sess.repopath}; // file:sess.mainPath, platform:sess.platform_id};
setWaitDialog(false); setWaitDialog(false);
gaEvent('sync', 'import', githuburl);
gotoNewLocation(replaceURL); gotoNewLocation(replaceURL);
}).catch( (e) => { }).catch( (e) => {
setWaitDialog(false); setWaitDialog(false);
@ -507,6 +513,7 @@ function _publishProjectToGithub(e) {
return pushChangesToGithub('initial import from 8bitworkshop.com'); return pushChangesToGithub('initial import from 8bitworkshop.com');
}).then( () => { }).then( () => {
setWaitProgress(1.0); setWaitProgress(1.0);
gaEvent('sync', 'publish', priv?"":name);
reloadProject(current_project.stripLocalPath(current_project.mainPath)); reloadProject(current_project.stripLocalPath(current_project.mainPath));
}).catch( (e) => { }).catch( (e) => {
setWaitDialog(false); setWaitDialog(false);
@ -1725,7 +1732,7 @@ function installGAHooks() {
if (ga) { if (ga) {
$(".dropdown-item").click((e) => { $(".dropdown-item").click((e) => {
if (e.target && e.target.id) { if (e.target && e.target.id) {
ga('send', 'event', 'menu', 'click', e.target.id); gaEvent('menu', e.target.id);
} }
}); });
} }
@ -1756,6 +1763,7 @@ function startPlatform() {
// start platform and load file // start platform and load file
replaceURLState(); replaceURLState();
platform.start(); platform.start();
if (ga) ga('send', 'pageview', location.pathname + '?platform=' + platform_id);
// TODO: ordering of loads? // TODO: ordering of loads?
loadBIOSFromProject(); loadBIOSFromProject();
initProject(); initProject();