Commit 7ee8d268e46101900058848a6eeb9bf4bcfadd72

Authored by Marcos Oliveira
1 parent 039cc133

validar

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