You can add custom activity to track additional activities from contacts.
Create Custom Resource
To start, you need to create a custom resource that will be used to store data for custom activity. Go to custom resources page and add a new custom resource.
Things to note:
- Key can't be changed later.
- Select Activity for kind.
Click Save to create custom resource. After resource is created, click View Properties to go to resource properties page.
When a custom resource with activity kind is created, OnVoard will automatically generate the following properties:
activity_id
activity_datetime
contact_id
contact_email
These properties will be present in all activity resource and cannot be modified or deleted. OnVoard will automatically augment values for these properties when we record a contact activity.
You can add additional properties to this resource if you want to pass more data for activity. For example, a Wishlist Item Added activity will have the following properties:
- activity_id (Auto Generated)
- activity_datetime (Auto Generated)
- contact_id (Auto Generated)
- contact_email (Auto Generated)
- product_id
- product_name
- wishlist_id
- wishlist_name
The data you pass when recording activity would look something like:
{
"product_id": "56789",
"product_name": "Spiderman Mini",
"wishlist_id": "12345",
"wishlist_name": "Toy Collectibles"
}
Actual recorded data after augmentation by OnVoard would be like:
{
"activity_id": "ctact_zber4co2k1lme1m1yztk",
"activity_datetime": 1592650039,
"contact_id": "ct_99pjwz4m1sx9ej8",
"contact_email": "jane@example.com",
"product_id": "56789",
"product_name": "Spiderman Mini",
"wishlist_id": "12345",
"wishlist_name": "Toy Collectibles"
}
Create Custom Contact Activity
After resource has been created, go to custom contact activities page to add activity.
Select the resource that you have just created. Ideally, activity name should be the same as linked resource name.
Descriptor Template (Optional)
You can also specify descriptor template for activity. Generated descriptor will be shown in contact's profile timeline to provide activity details. Liquid template language is used to generate output and resource properties will be available as variables.
Record Data:
{
"order_number": 1038,
"currency": "SGD",
"total_price": 15.55,
}
Descriptor Template:
Placed order #{{ order_number }} worth {{ currency }} {{ total_price }}.
Descriptor Output:
Placed order #1038 worth SGD 15.55.
A preview of descriptor output generated from record data and descriptor template.
Generated descriptor will be shown in contact's profile page when displaying activities.
Recording Custom Activity
Javascript API
Use OnVoard's Web Tracking Javascript API to record custom activity on client side.
OnVoard API
Alternatively, use OnVoard API to record custom activity on server side. For more details, see OnVoard's API Docs.