Advertisement
Guest User

Untitled

a guest
Aug 23rd, 2019
135
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. setTimeout(function() {
  2.     var t = setInterval(function() {
  3.         if (window.jQuery != undefined) {
  4.             clearInterval(t);
  5.             clearTimeout(timeout);
  6.  
  7.             var metrics = (function() {
  8.                 var inherit = function(child, parent) {
  9.                     child.prototype = Object.create(parent.prototype);
  10.                 };
  11.                 function BaseMetrics() {}
  12.                 BaseMetrics.prototype.log = function(attribute) {
  13.                     console.log(
  14.                         "Action " +
  15.                             this.actionName +
  16.                             ' com attributo "' +
  17.                             attribute +
  18.                             '" foi registrada'
  19.                     );
  20.                 };
  21.                 function VisitorMetrics(testName, actionName, shouldLog) {
  22.                     this.testName = testName;
  23.                     this.actionName = actionName;
  24.                     this.shouldLog = shouldLog || false;
  25.                 }
  26.                 inherit(VisitorMetrics, BaseMetrics);
  27.                 VisitorMetrics.prototype.fire = function(attribute) {
  28.                     attribute = attribute || "";
  29.                     this.shouldLog && this.log(attribute);
  30.                     mmsystem.SendUniqueAttribute(
  31.                         this.testName,
  32.                         this.actionName,
  33.                         1,
  34.                         attribute
  35.                     );
  36.                 };
  37.                 function ClickMetrics(actionName, shouldLog) {
  38.                     this.actionName = actionName;
  39.                     this.shouldLog = shouldLog || false;
  40.                 }
  41.                 inherit(ClickMetrics, BaseMetrics);
  42.                 ClickMetrics.prototype.fire = function(attribute, type) {
  43.                     attribute = attribute || "";
  44.                     var actionType = type === "postpone" ? "postpone" : "send";
  45.                     this.shouldLog && this.log(attribute);
  46.                     actions[actionType](this.actionName, 1, attribute);
  47.                 };
  48.                 return {
  49.                     visitor: VisitorMetrics,
  50.                     click: ClickMetrics
  51.                 };
  52.             })();
  53.  
  54.             var testName = "Novo Onboarding";
  55.             var shouldLog = false;
  56.             var trigger = {
  57.                 funil: new metrics.visitor(
  58.                     testName,
  59.                     "FluxoConcluido",
  60.                     shouldLog
  61.                 )
  62.             };
  63.            
  64.             //Disparar quando for final do fluxo
  65.             trigger.funil.fire("[NOME DO ONBOARDING]");
  66.             //Trocar [NOME DO ONBOARDING] pela versao que o usuario viu
  67.            
  68.         }
  69.     }, 50);
  70.     var timeout = setTimeout(function() {
  71.         clearInterval(t);
  72.     }, 9000);
  73. }, 3000);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement