You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
| session | A valid Hellotext session which was stored previously. When not set, Hellotext attempts to retrieve the stored value from `document.cookie` when available, otherwise it creates a new session. | String | null |
139
139
| autoGenerateSession | Whether the library should automatically generate a session when no session is found in the query or the cookies | Boolean | true |
140
140
| forms | An object that controls how Hellotext should control the forms on the page. See [Forms](/docs/forms.md) documentation for more information. | Object | { autoMount: true, successMessage: true } |
141
-
| webchat | An object that controls how Hellotext should control the webchat on the page. See [Webchat](/docs/webchat.md) documentation for more information. | Object | { autoMount: true, successMessage: true }|
141
+
| webchat | An object that controls how Hellotext should control the webchat on the page. See [Webchat](/docs/webchat.md) documentation for more information. | Object | {} |
'The value must be unique and it is already present in another object of the same type.',
81
+
description:'This required parameter has an empty value. Provide a valid value for the parameter.',
83
82
},
84
83
]
85
84
}
86
85
```
87
86
88
87
For a complete list of errors types. See [Error Types](https://www.hellotext.com/api#errors)
89
88
90
-
### Associated objects
89
+
### Event parameters
91
90
92
-
Generally, most actions also require an associated object. These can be of type [`app`](https://www.hellotext.com/api#apps), [`coupon`](https://www.hellotext.com/api#coupons), [`form`](https://www.hellotext.com/api#forms), [`order`](https://www.hellotext.com/api#orders), [`product`](https://www.hellotext.com/api#products) and [`refund`](https://www.hellotext.com/api#refunds).
93
-
Aside from [Custom Actions](https://www.hellotext.com/api#create_an_action), which don't require the trackable to be present.
91
+
Every tracked event has the following parameters which you can pass to the `track` method:
|**amount**| Monetary amount that represents the revenue associated to this tracked event. | float |`0`|
97
+
|**currency**| Currency for the `amount` given in ISO 4217 format. If not specified, the currency default to the business' configured reporting currency. | currency |`USD`|
98
+
|**metadata**| Set of key-value pairs that you can attach to an event. This can be useful for storing additional information about the object in a structured format. | hash |`{}`|
99
+
|**tracked_at**| Original date when the event happened. This is useful if you want to record an event that happened in the past. If no value is provided its value will be the same from `created_at`. | epoch |`null`|
100
+
101
+
### Associated object parameters
102
+
103
+
Generally, most actions also require an associated object. These can be of type [`app`](https://www.hellotext.com/api#apps), [`coupon`](https://www.hellotext.com/api#coupons), [`form`](https://www.hellotext.com/api#forms), [`order`](https://www.hellotext.com/api#orders), [`product`](https://www.hellotext.com/api#products) and [`refund`](https://www.hellotext.com/api#refunds), these events require an existing object to be present
104
+
in order to be tracked aside from [Custom Actions](https://www.hellotext.com/api#create_an_action), which don't require the trackable to be present.
105
+
106
+
Associated objects are represented by three possible parameters:
107
+
108
+
-`object`: An ID of an existing object of the same type. For example, when tracking app events, the `object` must be a previously created app object.
109
+
-`object_parameters`: A set of parameters for creating a new object of the same type. For example, when tracking app events, the `object_parameters` must be a set of parameters for creating a new app object.
110
+
-`object_type`: An ID or `name` of an existing custom object. Only required when tracking custom objects. Lets Hellotext know which type of object is being tracked. Learn more about [Objects](https://www.hellotext.com/api#objects).
94
111
95
112
You can create the associated object directly by defining its parameters in a hash:
96
113
97
114
```javascript
98
115
Hellotext.track('order.placed', {
99
116
amount:395.0,
100
117
currency:'USD',
101
-
order_parameters: {
102
-
amount:'395.00',
118
+
object_parameters: {
103
119
reference:'654321',
120
+
source:'myshop',
121
+
items: [
122
+
{
123
+
product:'erA2RAXE',
124
+
quantity:2,
125
+
}
126
+
]
104
127
},
105
128
})
106
129
```
@@ -112,57 +135,69 @@ For more information about identifiers, view the [Tracking API](https://www.hell
112
135
Hellotext.track('product.purchased', {
113
136
amount:395.0,
114
137
currency:'USD',
115
-
product:'erA2RAXE',
138
+
object:'erA2RAXE',
116
139
})
117
140
```
118
141
119
142
## List of actions
120
143
121
-
The following is a complete list of built-in actions and their required associated objects.
144
+
The following is a complete list of built-in actions and their required associated objects. Each associated action accepts a possible set of two parameters
|**app.installed**| An app was installed. |`object` or [object_parameters](https://www.hellotext.com/api#app)|
151
+
|**app.removed**| An app was removed. |`object` or [object_parameters](https://www.hellotext.com/api#app)|
152
+
|**app.spent**| A customer spent on an app. |`object` or [object_parameters](https://www.hellotext.com/api#app)|
153
+
|**cart.abandoned**| A cart was abandoned. |`object` or [object_parameters](https://www.hellotext.com/api#products)|
154
+
|**cart.added**| Added an item to the cart. |`object` or [object_parameters](https://www.hellotext.com/api#products)|
155
+
|**cart.removed**| Removed an item from the cart. |`object` or [object_parameters](https://www.hellotext.com/api#products)|
156
+
|**coupon.redeemed**| A coupon was redeem by a customer. |`object` or [object_parameters](https://www.hellotext.com/api#coupons)|
157
+
|**form.completed**| A form was completed by the customer. |`object` or [object_parameters](https://www.hellotext.com/api#forms)|
158
+
|**order.placed**| Order has been placed. |`object` or [object_parameters](https://www.hellotext.com/api#orders)|
159
+
|**order.confirmed**| Order has been confirmed by you. |`object` or [object_parameters](https://www.hellotext.com/api#orders)|
160
+
|**order.cancelled**| Order has been cancelled either by you or your customer. |`object` or [object_parameters](https://www.hellotext.com/api#orders)|
161
+
|**order.shipped**| Order has been shipped to your customer. |`object` or [object_parameters](https://www.hellotext.com/api#orders)|
162
+
|**order.delivered**| Order has been delivered to your customer. |`object` or [object_parameters](https://www.hellotext.com/api#orders)|
138
163
|**page.viewed**| A page was viewed by a customer. |`url`|
139
-
|**product.purchased**| A product has been purchased. |`product` or [product_parameters](https://www.hellotext.com/api#products)|
140
-
|**product.viewed**| A product page has been viewed. |`product` or [product_parameters](https://www.hellotext.com/api#products)|
141
-
|**refund.requested**| A customer requested a refund. |`refund` or [refund_parameters](https://www.hellotext.com/api#refunds)|
142
-
|**refund.received**| A refund was issued by you to your customer. |`refund` or [refund_parameters](https://www.hellotext.com/api#refunds)|
164
+
|**product.purchased**| A product has been purchased. |`object` or [object_parameters](https://www.hellotext.com/api#products)|
165
+
|**product.viewed**| A product page has been viewed. |`object` or [object_parameters](https://www.hellotext.com/api#products)|
166
+
|**refund.requested**| A customer requested a refund. |`object` or [object_parameters](https://www.hellotext.com/api#refunds)|
167
+
|**refund.received**| A refund was issued by you to your customer. |`object` or [object_parameters](https://www.hellotext.com/api#refunds)|
143
168
144
169
You can also create your **[own defined actions](https://www.hellotext.com/api#actions)**.
145
170
146
-
##Additional Properties
171
+
### Tracking Custom Actions
147
172
148
-
You can include additional attributes to the tracked event, additional properties must be included inside the `metadata` object:
173
+
Once you have created a custom action, you track it by specifying the action's name. Custom actions do not require an associated object to be present in order to be tracked.
174
+
However, it's possible to track custom actions alongside existing Objects, or new objects you introduce.
149
175
150
176
```javascript
151
-
Hellotext.track('product.purchased', {
152
-
amount:0.2,
153
-
currency:'USD',
154
-
metadata: {
155
-
myProperty:'custom',
156
-
},
157
-
tracked_at:1665684173,
177
+
// Custom Action without an associated object
178
+
179
+
Hellotext.track('appointment.booked')
180
+
181
+
// Custom Action with an existing custom object instance.
182
+
183
+
Hellotext.track('appointment.booked', {
184
+
object_type:'appointment',
185
+
object:'erA2RAXE',
158
186
})
159
-
```
160
187
161
-
### List of additional attributes
188
+
// Custom Action with a new custom object instance.
|**amount**| Monetary amount that represents the revenue associated to this tracked event. | float |`0`|
166
-
|**currency**| Currency for the `amount` given in ISO 4217 format. | currency |`USD`|
167
-
|**metadata**| Set of key-value pairs that you can attach to an event. This can be useful for storing additional information about the object in a structured format. | hash |`{}`|
168
-
|**tracked_at**| Original date when the event happened. This is useful if you want to record an event that happened in the past. If no value is provided its value will be the same from `created_at`. | epoch |`null`|
0 commit comments