Blame view

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