Commit 3229404f1f39a2e9c70606a19bd6b4b648a0cc2a

Authored by Marcos Olveira
1 parent cd08b2bf

versão inicial

Showing 1 changed file with 190 additions and 0 deletions
js/inline/Readme.md 0 → 100644
  1 +Trigger #
  2 +
  3 +### Action
  4 +Action to be triggered to Execultar the event.
  5 +* Attributes (optional)
  6 +    * Name: string - name attribute
  7 +    * Type: option - type attribute
  8 +    * Function: string - function that will dynamically capture the value of the attribute. Example:
  9 +`` `Javascript
  10 + return Funifier ._ $ ('# age') val ().;
  11 +`` `
  12 +
  13 +### Event
  14 +Event Type to be monitored
  15 +
  16 +### Selector
  17 +Element will be done bind the event.
  18 +
  19 +Page ###
  20 +Page (s) that will be monitoring the event.
  21 +
  22 +### Pre Script (optional)
  23 +Function performed prior to bind the element.
  24 +
  25 +Available variables:
  26 +- Element: element gift
  27 +- Trigger: object
  28 +    * _id: String
  29 +    * Name: string
  30 +    * Actions: array
  31 +    * Trigger: string ('click', 'pageview' ...)
  32 +    * Selector: string,
  33 +    * Page: string,
  34 +    * Pre_script: string
  35 +    * Port_script: string,
  36 +    * Pre_validation_script: string
  37 +
  38 +Example:
  39 +
  40 +If the element to be rendered via ajax, one can create a function to make the track manually.
  41 +
  42 +`` `Javascript
  43 + Funifier ._ $ ('body'). On ('click', trigger.selector, function () {
  44 +    Funifier.track ({action: trigger._id, TRIGGER_TYPE: 'TRIGGER_HTML'});
  45 + });
  46 +`` `
  47 +Note 1: As we are traqueando the id of the trigger must inform the trigger type as trigger_html, but the server will interpret the id as the id action.
  48 +
  49 +Note 2: If you do the track manually, you must retonar false in pre validate to avoid unexpected behavior, as more than once traquear the same event.
  50 +
  51 +### Pre Validity (optional)
  52 +Validation function performed before being made the track, waiting for the return of a boolean if the false seje return will not be made the track.
  53 +
  54 +Available variables:
  55 +- Element: element gift
  56 +- Trigger: object
  57 +    * _id: String
  58 +    * Name: string
  59 +    * Actions: array
  60 +    * Trigger: string ('click', 'pageview' ...)
  61 +    * Selector: string,
  62 +    * Page: string,
  63 +    * Pre_script: string
  64 +    * Port_script: string,
  65 +    * Pre_validation_script: string
  66 +
  67 +Example:
  68 +`` `Javascript
  69 + var value = Funifier ._ $ ('# name') val ().;
  70 + if (value.length> 0) {
  71 + // Blank field will not be made the track
  72 + return false;
  73 +}
  74 +return true;
  75 +`` `
  76 +
  77 +
  78 +### Post Script (optional)
  79 +Function performed after the track.
  80 +
  81 +Available variables:
  82 +- Trigger: object
  83 +    * _id: String
  84 +    * Name: string
  85 +    * Actions: array
  86 +    * Trigger: string ('click', 'pageview' ...)
  87 +    * Selector: string,
  88 +    * Page: string,
  89 +    * Pre_script: string
  90 +    * Port_script: string,
  91 +    * Pre_validation_script: string
  92 +    
  93 +Example:
  94 +`` `Javascript
  95 + alert ('traqueada action');
  96 +`` `
  97 +
  98 +Note: In some cases these function can not be performed, depending on the context, such as in a page redirection.
  99 +
  100 +
  101 +### Run only client
  102 +
  103 +If the event seje "Page View", you can cancel the track on the server of the shares in order to run any script as traquear manually.
  104 +
  105 +
  106 +### Name (Optional)
  107 +Name for reference in the studio
  108 +Variáveis disponíveis:
  109 +- element : dom element
  110 +- trigger : object
  111 + * _id : string
  112 + * name : string
  113 + * actions : array
  114 + * trigger : string ('click','pageview' ...)
  115 + * selector : string,
  116 + * page : string,
  117 + * pre_script : string
  118 + * port_script : string,
  119 + * pre_validation_script : string
  120 +
  121 +Exemplo:
  122 +
  123 +Caso o elemento seja renderizado via ajax, pode-se criar uma função para fazer o track manualmente.
  124 +
  125 +```javascript
  126 + Funifier._$('body').on('click',trigger.selector,function(){
  127 + Funifier.track({action:trigger._id,trigger_type: 'TRIGGER_HTML'});
  128 + });
  129 +```
  130 +Observação1: Como estamos traqueando o id da trigger devemos informar o trigger type como trigger_html, senão o servidor irá interpretar o id como id da action.
  131 +
  132 +Observação2: Caso você faça o track manualmente, você deve retonar false no pre validate, para evitar comportamentos inesperados, como traquear mais de uma vez o mesmo evento.
  133 +
  134 +### Pré Validade (opcional)
  135 +Função de validação executada antes de ser efetuado o track, espera o retorno de um boolean, caso o retorno seje falso não será feito o track.
  136 +
  137 +Variáveis disponíveis:
  138 +- element : dom element
  139 +- trigger : object
  140 + * _id : string
  141 + * name : string
  142 + * actions : array
  143 + * trigger : string ('click','pageview' ...)
  144 + * selector : string,
  145 + * page : string,
  146 + * pre_script : string
  147 + * port_script : string,
  148 + * pre_validation_script : string
  149 +
  150 +Exemplo:
  151 +```javascript
  152 + var value= Funifier._$('#name').val();
  153 + if(value.length>0){
  154 + //Campo em branco, não será feito o track
  155 + return false;
  156 +}
  157 +return true;
  158 +```
  159 +
  160 +
  161 +### Post Script (opcional)
  162 +Função executada depois do track.
  163 +
  164 +Variáveis disponíveis:
  165 +- trigger : object
  166 + * _id : string
  167 + * name : string
  168 + * actions : array
  169 + * trigger : string ('click','pageview' ...)
  170 + * selector : string,
  171 + * page : string,
  172 + * pre_script : string
  173 + * port_script : string,
  174 + * pre_validation_script : string
  175 +
  176 +Exemplo:
  177 +```javascript
  178 + alert('Acão traqueada');
  179 +```
  180 +
  181 +Observação: Em alguns casos essas função pode não ser executada, dependendo do contexto, como por exemplo em um redirecionamento de pagina.
  182 +
  183 +
  184 +### Run only client
  185 +
  186 +Caso o evento seje "Page View", pode-se cancelar o track no servidor das ações para poder executar algum script como traquear manualmente.
  187 +
  188 +
  189 +### Name (opcional)
  190 +Nome para referencia dentro do studio.
0 191 \ No newline at end of file
... ...