Skip to content

Commit a088618

Browse files
committed
update readme
1 parent 056a914 commit a088618

File tree

2 files changed

+38
-4
lines changed

2 files changed

+38
-4
lines changed

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -138,4 +138,4 @@ Hellotext.initialize('HELLOTEXT_BUSINESS_ID', configurationOptions)
138138
| 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 |
139139
| autoGenerateSession | Whether the library should automatically generate a session when no session is found in the query or the cookies | Boolean | true |
140140
| 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 | {} |

docs/tracking.md

+37-3
Original file line numberDiff line numberDiff line change
@@ -92,9 +92,9 @@ Every tracked event has the following parameters which you can pass to the `trac
9292

9393

9494
| Property | Description | Type | Default |
95-
| -------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------- | ------- |
95+
| -------------- |---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| -------- | ------- |
9696
| **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. | currency | `USD` |
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` |
9898
| **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 | `{}` |
9999
| **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` |
100100

@@ -107,7 +107,7 @@ Associated objects are represented by three possible parameters:
107107

108108
- `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.
109109
- `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.
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).
111111

112112
You can create the associated object directly by defining its parameters in a hash:
113113

@@ -167,3 +167,37 @@ The following is a complete list of built-in actions and their required associat
167167
| **refund.received** | A refund was issued by you to your customer. | `object` or [object_parameters](https://www.hellotext.com/api#refunds) |
168168

169169
You can also create your **[own defined actions](https://www.hellotext.com/api#actions)**.
170+
171+
### Tracking Custom Actions
172+
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.
175+
176+
```javascript
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',
186+
})
187+
188+
// Custom Action with a new custom object instance.
189+
Hellotext.track('appointment.booked', {
190+
object_type: 'appointment',
191+
object_parameters: {
192+
room: 'AA-101',
193+
booked_at: 1632313200,
194+
}
195+
})
196+
197+
// Custom Action with a builtin object instance.
198+
199+
Hellotext.track('appointment.booked', {
200+
object_type: 'product',
201+
object: 'erA2RAXE',
202+
})
203+
```

0 commit comments

Comments
 (0)