1
0
Fork 0
mirror of synced 2024-05-20 20:52:36 +12:00

Update analytics events

This commit is contained in:
Eldad Fux 2020-02-03 21:20:10 +02:00
parent b51cb0b6e1
commit 29badc782e
11 changed files with 49 additions and 49 deletions

View file

@ -16,7 +16,7 @@
data-scope="console"
data-event="load"
data-failure="trigger"
data-failure-param-trigger-events="logout">
data-failure-param-trigger-events="account.deleteSession">
<div class="pull-end console-back">
<a href="/console">Back to Console &nbsp;<i class="icon-right-open"></i></a>

View file

@ -1,5 +1,8 @@
<section class="zone medium">
<form class="box margin-top-large"
data-analytics-event="submit"
data-analytics-category="home"
data-analytics-label="Update Team Membership Status"
data-service="teams.updateMembershipStatus"
data-scope="console"
data-event="submit"

View file

@ -5,15 +5,18 @@
<small class="pull-end">* All fields are required</small>
<form name="recovery"
data-service="account.createRecovery"
data-scope="console"
data-event="submit"
data-success="alert"
data-success-alert="We have sent you a mail with a password reset link"
data-failure="alert"
data-failure-param-alert-text="Password recovery failed"
data-failure-param-alert-classname="error">
<form name="account.createRecovery"
data-analytics-event="submit"
data-analytics-category="home"
data-analytics-label="Create Account Recovery"
data-service="account.createRecovery"
data-scope="console"
data-event="submit"
data-success="alert"
data-success-alert="We have sent you a mail with a password reset link"
data-failure="alert"
data-failure-param-alert-text="Password recovery failed"
data-failure-param-alert-classname="error">
<label>Email</label>
<input name="email" type="email" class="full-width" autocomplete="email" placeholder="me@example.com" required>

View file

@ -9,15 +9,18 @@
<br />
<form name="recovery-reset"
data-service="account.updateRecovery"
data-scope="console"
data-event="submit"
data-success="alert,redirect"
data-success-param-alert="Password Reset Completed"
data-success-param-url="/auth/signin"
data-failure="alert"
data-failure-param-alert-text="Password Reset Failed"
data-failure-param-alert-classname="error">
data-analytics-event="submit"
data-analytics-category="home"
data-analytics-label="Update Account Recovery"
data-service="account.updateRecovery"
data-scope="console"
data-event="submit"
data-success="alert,redirect"
data-success-param-alert="Password Reset Completed"
data-success-param-url="/auth/signin"
data-failure="alert"
data-failure-param-alert-text="Password Reset Failed"
data-failure-param-alert-classname="error">
<input type="hidden" name="userId" data-ls-bind="{{router.params.userId}}">
<input type="hidden" name="secret" data-ls-bind="{{router.params.secret}}">

View file

@ -8,6 +8,9 @@
<p>Login using email and password</p>
<form name="account.createSession"
data-analytics-event="submit"
data-analytics-category="home"
data-analytics-label="Create Account Session"
data-service="account.createSession"
data-scope="console"
data-event="submit"

View file

@ -7,7 +7,10 @@
<small class="pull-end">* All fields are required</small>
<form name="register"
<form name="account.create"
data-analytics-event="submit"
data-analytics-category="home"
data-analytics-label="Create Account"
data-service="account.create"
data-scope="console"
data-event="submit"

View file

@ -2397,7 +2397,7 @@ children[prop]=template.cloneNode(true);element.appendChild(children[prop]);(ind
container.set('$index',originalIndex,true,false);container.set('$prefix',originalPrefix,true,false);container.set('$as',originalAs,true,false);element.dispatchEvent(new Event('looped'));};let template=(element.children.length===1)?element.children[0]:window.document.createElement('li');echo();container.bind(element,expr+'.length',echo);let path=(expr+'.length').split('.');while(path.length){container.bind(element,path.join('.'),echo);path.pop();}}});window.ls.container.get('view').add({selector:'data-ls-template',template:false,repeat:true,controller:function(element,view,http,expression,document){let template=expression.parse(element.getAttribute('data-ls-template'));let type=element.getAttribute('data-type')||'url';element.innerHTML='';if('script'===type){let inlineTemplate=document.getElementById(template);if(inlineTemplate&&inlineTemplate.innerHTML){element.innerHTML=inlineTemplate.innerHTML;element.dispatchEvent(new CustomEvent('template-loaded',{bubbles:true,cancelable:false}));}
else{element.innerHTML='<span style="color: red">Missing template "'+template+'"</span>';}
return;}
http.get(template).then(function(element){return function(data){element.innerHTML=data;view.render(element);element.dispatchEvent(new CustomEvent('template-loaded',{bubbles:true,cancelable:false}));}}(element),function(){throw new Error('Failed loading template');});}});window.ls.error=function(){return function(error){console.error("ERROR-APP",error);};};window.addEventListener("error",function(event){console.error("ERROR-EVENT:",event.error.message,event.error.stack);});document.addEventListener("deleteCurrentSession",function(){window.location="/auth/signin";});document.addEventListener("http-get-401",function(){document.dispatchEvent(new CustomEvent("deleteCurrentSession"));},true);(function(window){"use strict";window.ls.container.set('alerts',function(window){return{list:[],ids:0,counter:0,max:5,add:function(message,time){var scope=this;message.id=scope.ids++;scope.counter++;scope.list.unshift(message);if(scope.counter>scope.max){scope.list.pop();scope.counter--;}
http.get(template).then(function(element){return function(data){element.innerHTML=data;view.render(element);element.dispatchEvent(new CustomEvent('template-loaded',{bubbles:true,cancelable:false}));}}(element),function(){throw new Error('Failed loading template');});}});window.ls.error=function(){return function(error){console.error("ERROR-APP",error);};};window.addEventListener("error",function(event){console.error("ERROR-EVENT:",event.error.message,event.error.stack);});document.addEventListener("account.deleteSession",function(){window.location="/auth/signin";});(function(window){"use strict";window.ls.container.set('alerts',function(window){return{list:[],ids:0,counter:0,max:5,add:function(message,time){var scope=this;message.id=scope.ids++;scope.counter++;scope.list.unshift(message);if(scope.counter>scope.max){scope.list.pop();scope.counter--;}
if(time>0){window.setTimeout(function(message){return function(){scope.remove(message.id)}}(message),time);}
return message.id;},remove:function(id){let scope=this;for(let index=0;index<scope.list.length;index++){let obj=scope.list[index];if(obj.id===parseInt(id)){scope.counter--;if(typeof obj.callback==="function"){obj.callback();}
scope.list.splice(index,1);};}}};},true,true);})(window);(function(window){"use strict";window.ls.container.set('console',function(window){var sdk=new window.Appwrite();sdk.setEndpoint(APP_ENV.API).setProject('console').setLocale(APP_ENV.LOCALE);return sdk;},true);})(window);(function(window){"use strict";window.ls.container.set('date',function(){function format(format,timestamp){var jsdate,f
@ -2603,16 +2603,15 @@ success[i].charAt(0).toUpperCase()+
success[i].slice(1),{}));}
container.set("serviceData",null,true,true);container.set("serviceForm",null,true,true);element.$lsSkip=false;view.render(element);},function(exception){if(loaderId!==null){alerts.remove(loaderId);}
if(!element){return;}
for(let i=0;i<failure.length;i++){container.resolve(resolve(callbacks[failure[i]],"failureParam"+
element.classList.add("load-service-end");for(let i=0;i<failure.length;i++){container.resolve(resolve(callbacks[failure[i]],"failureParam"+
failure[i].charAt(0).toUpperCase()+
failure[i].slice(1),{}));}
element.$lsSkip=false;view.render(element);});};let events=event.trim().split(",");for(let y=0;y<events.length;y++){if(""===events[y]){continue;}
switch(events[y].trim()){case"load":exec();break;case"none":break;case"click":case"change":case"keypress":case"keydown":case"keyup":case"input":case"submit":element.addEventListener(events[y],exec);break;default:document.addEventListener(events[y],exec);}
if(debug)
console.log('%cregistered: "'+events[y].trim()+'" ('+service+")","color:blue");}}});})(window);(function(window){"use strict";window.ls.container.get("view").add({selector:"data-analytics-event",controller:function(element){var action=element.getAttribute("data-event-action")||"click";element.addEventListener(action,function(){var category=element.getAttribute("data-event-category")||"undefined";var label=element.getAttribute("data-event-label")||"undefined";if(!ga){console.error("Google Analytics ga object is not available");}
console.log('%cregistered: "'+events[y].trim()+'" ('+service+")","color:blue");}}});})(window);(function(window){"use strict";window.ls.container.get("view").add({selector:"data-analytics-event",controller:function(element){var action=element.getAttribute("data-event-action")||"click";element.addEventListener(action,function(){var category=element.getAttribute("data-analytics-category")||"undefined";var label=element.getAttribute("data-analytics-label")||"undefined";if(!ga){console.error("Google Analytics ga object is not available");}
ga("send",{hitType:"event",eventCategory:category,eventAction:action,eventLabel:label});});}});})(window);(function(window){"use strict";window.ls.container.get("view").add({selector:"data-analytics-pageview",controller:function(window,router){if(!ga){console.error("Google Analytics ga object is not available");}
var company=router.params["company"]||null;if(!company){}
ga("set","page",window.location.pathname);ga("set","dimension1",company);ga("send","pageview");}});})(window);(function(window){"use strict";window.ls.container.get("view").add({selector:"data-forms-clone",controller:function(element,document,view){var template=element.innerHTML.toString();var label=element.dataset["label"]||"Add";var icon=element.dataset["icon"]||null;var target=element.dataset["target"]||null;var first=parseInt(element.dataset["first"]||1);var button=document.createElement("button");button.type="button";button.innerText=" "+label+" ";button.classList.add("margin-end");button.classList.add("margin-bottom-small");button.classList.add("reverse");if(icon){var iconElement=document.createElement("i");iconElement.className=icon;button.insertBefore(iconElement,button.firstChild);}
var project=router.params["project"]||'None';ga("set","page",window.location.pathname);ga("set","dimension1",project);ga("send","pageview");}});})(window);(function(window){"use strict";window.ls.container.get("view").add({selector:"data-forms-clone",controller:function(element,document,view){var template=element.innerHTML.toString();var label=element.dataset["label"]||"Add";var icon=element.dataset["icon"]||null;var target=element.dataset["target"]||null;var first=parseInt(element.dataset["first"]||1);var button=document.createElement("button");button.type="button";button.innerText=" "+label+" ";button.classList.add("margin-end");button.classList.add("margin-bottom-small");button.classList.add("reverse");if(icon){var iconElement=document.createElement("i");iconElement.className=icon;button.insertBefore(iconElement,button.firstChild);}
if(target){target=document.getElementById(target);}
button.addEventListener("click",function(){var clone=document.createElement(element.tagName);if(element.name){clone.name=element.name;}
clone.innerHTML=template;clone.className=element.className;view.render(clone);if(target){target.appendChild(clone);}else{button.parentNode.insertBefore(clone,button);}

View file

@ -123,7 +123,7 @@ children[prop]=template.cloneNode(true);element.appendChild(children[prop]);(ind
container.set('$index',originalIndex,true,false);container.set('$prefix',originalPrefix,true,false);container.set('$as',originalAs,true,false);element.dispatchEvent(new Event('looped'));};let template=(element.children.length===1)?element.children[0]:window.document.createElement('li');echo();container.bind(element,expr+'.length',echo);let path=(expr+'.length').split('.');while(path.length){container.bind(element,path.join('.'),echo);path.pop();}}});window.ls.container.get('view').add({selector:'data-ls-template',template:false,repeat:true,controller:function(element,view,http,expression,document){let template=expression.parse(element.getAttribute('data-ls-template'));let type=element.getAttribute('data-type')||'url';element.innerHTML='';if('script'===type){let inlineTemplate=document.getElementById(template);if(inlineTemplate&&inlineTemplate.innerHTML){element.innerHTML=inlineTemplate.innerHTML;element.dispatchEvent(new CustomEvent('template-loaded',{bubbles:true,cancelable:false}));}
else{element.innerHTML='<span style="color: red">Missing template "'+template+'"</span>';}
return;}
http.get(template).then(function(element){return function(data){element.innerHTML=data;view.render(element);element.dispatchEvent(new CustomEvent('template-loaded',{bubbles:true,cancelable:false}));}}(element),function(){throw new Error('Failed loading template');});}});window.ls.error=function(){return function(error){console.error("ERROR-APP",error);};};window.addEventListener("error",function(event){console.error("ERROR-EVENT:",event.error.message,event.error.stack);});document.addEventListener("deleteCurrentSession",function(){window.location="/auth/signin";});document.addEventListener("http-get-401",function(){document.dispatchEvent(new CustomEvent("deleteCurrentSession"));},true);(function(window){"use strict";window.ls.container.set('alerts',function(window){return{list:[],ids:0,counter:0,max:5,add:function(message,time){var scope=this;message.id=scope.ids++;scope.counter++;scope.list.unshift(message);if(scope.counter>scope.max){scope.list.pop();scope.counter--;}
http.get(template).then(function(element){return function(data){element.innerHTML=data;view.render(element);element.dispatchEvent(new CustomEvent('template-loaded',{bubbles:true,cancelable:false}));}}(element),function(){throw new Error('Failed loading template');});}});window.ls.error=function(){return function(error){console.error("ERROR-APP",error);};};window.addEventListener("error",function(event){console.error("ERROR-EVENT:",event.error.message,event.error.stack);});document.addEventListener("account.deleteSession",function(){window.location="/auth/signin";});(function(window){"use strict";window.ls.container.set('alerts',function(window){return{list:[],ids:0,counter:0,max:5,add:function(message,time){var scope=this;message.id=scope.ids++;scope.counter++;scope.list.unshift(message);if(scope.counter>scope.max){scope.list.pop();scope.counter--;}
if(time>0){window.setTimeout(function(message){return function(){scope.remove(message.id)}}(message),time);}
return message.id;},remove:function(id){let scope=this;for(let index=0;index<scope.list.length;index++){let obj=scope.list[index];if(obj.id===parseInt(id)){scope.counter--;if(typeof obj.callback==="function"){obj.callback();}
scope.list.splice(index,1);};}}};},true,true);})(window);(function(window){"use strict";window.ls.container.set('console',function(window){var sdk=new window.Appwrite();sdk.setEndpoint(APP_ENV.API).setProject('console').setLocale(APP_ENV.LOCALE);return sdk;},true);})(window);(function(window){"use strict";window.ls.container.set('date',function(){function format(format,timestamp){var jsdate,f
@ -329,16 +329,15 @@ success[i].charAt(0).toUpperCase()+
success[i].slice(1),{}));}
container.set("serviceData",null,true,true);container.set("serviceForm",null,true,true);element.$lsSkip=false;view.render(element);},function(exception){if(loaderId!==null){alerts.remove(loaderId);}
if(!element){return;}
for(let i=0;i<failure.length;i++){container.resolve(resolve(callbacks[failure[i]],"failureParam"+
element.classList.add("load-service-end");for(let i=0;i<failure.length;i++){container.resolve(resolve(callbacks[failure[i]],"failureParam"+
failure[i].charAt(0).toUpperCase()+
failure[i].slice(1),{}));}
element.$lsSkip=false;view.render(element);});};let events=event.trim().split(",");for(let y=0;y<events.length;y++){if(""===events[y]){continue;}
switch(events[y].trim()){case"load":exec();break;case"none":break;case"click":case"change":case"keypress":case"keydown":case"keyup":case"input":case"submit":element.addEventListener(events[y],exec);break;default:document.addEventListener(events[y],exec);}
if(debug)
console.log('%cregistered: "'+events[y].trim()+'" ('+service+")","color:blue");}}});})(window);(function(window){"use strict";window.ls.container.get("view").add({selector:"data-analytics-event",controller:function(element){var action=element.getAttribute("data-event-action")||"click";element.addEventListener(action,function(){var category=element.getAttribute("data-event-category")||"undefined";var label=element.getAttribute("data-event-label")||"undefined";if(!ga){console.error("Google Analytics ga object is not available");}
console.log('%cregistered: "'+events[y].trim()+'" ('+service+")","color:blue");}}});})(window);(function(window){"use strict";window.ls.container.get("view").add({selector:"data-analytics-event",controller:function(element){var action=element.getAttribute("data-event-action")||"click";element.addEventListener(action,function(){var category=element.getAttribute("data-analytics-category")||"undefined";var label=element.getAttribute("data-analytics-label")||"undefined";if(!ga){console.error("Google Analytics ga object is not available");}
ga("send",{hitType:"event",eventCategory:category,eventAction:action,eventLabel:label});});}});})(window);(function(window){"use strict";window.ls.container.get("view").add({selector:"data-analytics-pageview",controller:function(window,router){if(!ga){console.error("Google Analytics ga object is not available");}
var company=router.params["company"]||null;if(!company){}
ga("set","page",window.location.pathname);ga("set","dimension1",company);ga("send","pageview");}});})(window);(function(window){"use strict";window.ls.container.get("view").add({selector:"data-forms-clone",controller:function(element,document,view){var template=element.innerHTML.toString();var label=element.dataset["label"]||"Add";var icon=element.dataset["icon"]||null;var target=element.dataset["target"]||null;var first=parseInt(element.dataset["first"]||1);var button=document.createElement("button");button.type="button";button.innerText=" "+label+" ";button.classList.add("margin-end");button.classList.add("margin-bottom-small");button.classList.add("reverse");if(icon){var iconElement=document.createElement("i");iconElement.className=icon;button.insertBefore(iconElement,button.firstChild);}
var project=router.params["project"]||'None';ga("set","page",window.location.pathname);ga("set","dimension1",project);ga("send","pageview");}});})(window);(function(window){"use strict";window.ls.container.get("view").add({selector:"data-forms-clone",controller:function(element,document,view){var template=element.innerHTML.toString();var label=element.dataset["label"]||"Add";var icon=element.dataset["icon"]||null;var target=element.dataset["target"]||null;var first=parseInt(element.dataset["first"]||1);var button=document.createElement("button");button.type="button";button.innerText=" "+label+" ";button.classList.add("margin-end");button.classList.add("margin-bottom-small");button.classList.add("reverse");if(icon){var iconElement=document.createElement("i");iconElement.className=icon;button.insertBefore(iconElement,button.firstChild);}
if(target){target=document.getElementById(target);}
button.addEventListener("click",function(){var clone=document.createElement(element.tagName);if(element.name){clone.name=element.name;}
clone.innerHTML=template;clone.className=element.className;view.render(clone);if(target){target.appendChild(clone);}else{button.parentNode.insertBefore(clone,button);}

View file

@ -10,15 +10,6 @@ window.addEventListener("error", function(event) {
console.error("ERROR-EVENT:", event.error.message, event.error.stack);
});
document.addEventListener("deleteCurrentSession", function() {
document.addEventListener("account.deleteSession", function() {
window.location = "/auth/signin";
});
document.addEventListener(
"http-get-401",
function() {
/* on error */
document.dispatchEvent(new CustomEvent("deleteCurrentSession"));
},
true
);
});

View file

@ -8,8 +8,8 @@
element.addEventListener(action, function() {
var category =
element.getAttribute("data-event-category") || "undefined";
var label = element.getAttribute("data-event-label") || "undefined";
element.getAttribute("data-analytics-category") || "undefined";
var label = element.getAttribute("data-analytics-label") || "undefined";
if (!ga) {
console.error("Google Analytics ga object is not available");

View file

@ -8,15 +8,11 @@
console.error("Google Analytics ga object is not available");
}
var company = router.params["company"] || null;
if (!company) {
//return;
}
var project = router.params["project"] || 'None';
ga("set", "page", window.location.pathname);
ga("set", "dimension1", company);
ga("set", "dimension1", project);
//ga('set', 'dimension2', '');
ga("send", "pageview");