Event tracking can do a lot, but this is an almost perfect use case for custom objects. This will make tracking orders and sending multiple values easy.
Here’s how you do it:
1) Set up your schema (you only make this call once)
Following the information you provided, I want to create a custom object on a contact that tracks 5 different data points, that are linked:
- product name (text)
- product price (number)
- product link (text)
- order number (number)
- product link
First I have to create the “schema” to hold this data. The POST to https://{{yourAccountName}}.api-us1.com/api/3/customObjects/schemas
looks like below. You can see where I create the fields and mark them as “number” or “text”:
{
"schema": {
"labels": {
"singular": "Website Order",
"plural": "Website Orders"
},
"slug": "orders",
"description": "Example of custom objects for tracking orders",
"fields": [
{
"id": "order-price",
"slug": "order-price",
"labels": {
"singular": "Order Price",
"plural": "Order Prices"
},
"type": "number",
"scale": 0,
"isRequired": false
},
{
"id": "order-number",
"slug": "order-number",
"labels": {
"singular": "Order Number",
"plural": "Order Numbers"
},
"type": "number",
"scale": 0,
"isRequired": false
},
{
"id": "order-count",
"slug": "order-count",
"labels": {
"singular": "Order Count",
"plural": "Order Count"
},
"type": "number",
"scale": 0,
"isRequired": false
},
{
"id": "product-name",
"slug": "product-name",
"labels": {
"singular": "Product name",
"plural": "Product names"
},
"type": "text",
"scale": 0,
"isRequired": false
},
{
"id": "product-link",
"slug": "product-link",
"labels": {
"singular": "Product link",
"plural": "Product links"
},
"type": "text",
"scale": 0,
"isRequired": false
}
],
"relationships": [
{
"id": "primary-contact",
"labels": {
"singular": "Primary Contact",
"plural": "Primary Contacts"
},
"description": "Primary contact to this order",
"namespace": "contacts",
"hasMany": false
}
]
}
}
This first call returns the schema id we will be using to populate/track orders for our contacts.
When we made the POST call above, we got this back:
{
"schema": {
"id": "968535b7-9b8f-4398-af54-37611defcf89",
"slug": "orders",
"visibility": "private",
"labels": {
"singular": "Website Order",
"plural": "Website Orders"
},
"description": "Example of custom objects for tracking orders",
"createdTimestamp": "2022-08-15T19:10:53.865596638Z",
"updatedTimestamp": "2022-08-15T19:10:53.865596638Z",
"fields": [
{
"id": "order-price",
"labels": {
"singular": "Order Price",
"plural": "Order Prices"
},
"type": "number",
"required": false,
"scale": 0,
"inherited": false
},
{
"id": "order-number",
"labels": {
"singular": "Order Number",
"plural": "Order Numbers"
},
"type": "number",
"required": false,
"scale": 0,
"inherited": false
},
{
"id": "order-count",
"labels": {
"singular": "Order Count",
"plural": "Order Count"
},
"type": "number",
"required": false,
"scale": 0,
"inherited": false
},
{
"id": "product-name",
"labels": {
"singular": "Product name",
"plural": "Product names"
},
"type": "text",
"required": false,
"scale": 0,
"inherited": false
},
{
"id": "product-link",
"labels": {
"singular": "Product link",
"plural": "Product links"
},
"type": "text",
"required": false,
"scale": 0,
"inherited": false
}
],
"icons": {
"default": "https://d226aj4ao1t61q.cloudfront.net/n9mayqo2d_customobject.png"
},
"relationships": [
{
"id": "primary-contact",
"labels": {
"singular": "Primary Contact",
"plural": "Primary Contacts"
},
"description": "Primary contact to this order",
"namespace": "contacts",
"hasMany": false,
"inherited": false
}
]
}
}
You can see the schema that was created has the id 968535b7-9b8f-4398-af54-37611defcf89
we will be using that id for future calls to populate order data.