7ee8d268
Marcos Oliveira
validar
|
1
|
# Trigger
|
3229404f
Marcos Olveira
versão inicial
|
2
|
|
15e9cbf5
Esaú Freitas
ajustes
|
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
|
---
## Action
Action to be registered in funifier when execute an event.
### Parameters
**Attributes (Optional)**
* **name**: String - name of attribute
* **type**: Option - type of attribute
* **function**: String - function that dynamically capture the value of the attribute
#### Example
```javascript
return Funifier._$('#idade').val();
|
7ee8d268
Marcos Oliveira
validar
|
20
|
```
|
15e9cbf5
Esaú Freitas
ajustes
|
21
|
---
|
3229404f
Marcos Olveira
versão inicial
|
22
|
|
15e9cbf5
Esaú Freitas
ajustes
|
23
|
## Event
|
3229404f
Marcos Olveira
versão inicial
|
24
|
|
15e9cbf5
Esaú Freitas
ajustes
|
25
|
Event type to be monitored
|
3229404f
Marcos Olveira
versão inicial
|
26
|
|
15e9cbf5
Esaú Freitas
ajustes
|
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
|
---
## Selector
HTML element that will be mapped the event
---
## Page
Page(s) that will be monitoring the event
---
## Pre Script (Optional)
|
85a0fe80
Esaú Freitas
ajustes
|
42
|
Function performed before HTML element be mapped(bind)
|
15e9cbf5
Esaú Freitas
ajustes
|
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
|
### Javascript available variables:
- element: DOM element
- trigger: object
* **_id**: String
* **name**: String
* **actions**: Array
* **trigger**: String ['click','pageview',...]
* **selector**: String
* **page**: String
* **pre_script**: String
* **post_script**: String
* **pre_validation_script**: String
#### Example
Case the element is rendered by ajax, can create a function to call the function "track" manually
|
3229404f
Marcos Olveira
versão inicial
|
60
61
|
```javascript
|
15e9cbf5
Esaú Freitas
ajustes
|
62
63
64
|
Funifier ._ $ ('body'). On ('click', trigger.selector, function () {
Funifier.track ({action: trigger._id, TRIGGER_TYPE: 'TRIGGER_HTML'});
});
|
3229404f
Marcos Olveira
versão inicial
|
65
|
```
|
15e9cbf5
Esaú Freitas
ajustes
|
66
|
|
523a6f7d
Esaú Freitas
ajustes
|
67
68
|
##### Note 1: When we are using the id of the "trigger", must inform the trigger type attribute as "TRIGGER_HTML" in function "Funifier.track()"
##### Note 2: If you do the "track" manually, you must return false in pre validate to avoid unexpected behavior, for example register "track" more than once
|
15e9cbf5
Esaú Freitas
ajustes
|
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
|
---
# Pre Validation (Optional)
Validation function performed before to be registered "track" on the funifier. Expect the return as a boolean, case the return is "false", cancel the process and will not be registered the "track" on the Funifier.
### Javascript available variables:
- element: DOM element
- trigger: object
* **_id**: String
* **name**: String
* **actions**: Array
* **trigger**: String ['click','pageview',...]
* **selector**: String
* **page**: String
* **pre_script**: String
* **post_script**: String
* **pre_validation_script**: String
#### Example
|
3229404f
Marcos Olveira
versão inicial
|
91
|
```javascript
|
15e9cbf5
Esaú Freitas
ajustes
|
92
93
94
95
|
var value = Funifier._$('# name').val();
if(value.length > 0) {
// Blank field will not be made the track
return false;
|
3229404f
Marcos Olveira
versão inicial
|
96
97
98
|
}
return true;
```
|
15e9cbf5
Esaú Freitas
ajustes
|
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
|
---
# Post Script (Optional)
Function performed after the track.
### Javascript available variables:
- element: DOM element
- trigger: object
* **_id**: String
* **name**: String
* **actions**: Array
* **trigger**: String ['click','pageview',...]
* **selector**: String
* **page**: String
* **pre_script**: String
* **post_script**: String
* **pre_validation_script**: String
#### Example
|
3229404f
Marcos Olveira
versão inicial
|
121
|
```javascript
|
15e9cbf5
Esaú Freitas
ajustes
|
122
|
alert('action tracked');
|
3229404f
Marcos Olveira
versão inicial
|
123
|
```
|
15e9cbf5
Esaú Freitas
ajustes
|
124
125
126
127
|
##### Note: In some cases these function can not be performed, depend of the context, for example: redirection of page.
---
|
3229404f
Marcos Olveira
versão inicial
|
128
|
|
7ee8d268
Marcos Oliveira
validar
|
129
|
# Run only client
|
3229404f
Marcos Olveira
versão inicial
|
130
|
|
15e9cbf5
Esaú Freitas
ajustes
|
131
132
133
134
|
If the event is "page view" can be done "Track" manually
# Name (Optional)
Name for reference in the studio
|