If your website includes an e-commerce component where users can select items
to add to a shopping cart and then later purchase those items, consider using
Iterable's commerce events. These special events keep track of users' shopping
carts and their purchases. These are stored in a user's history as updateCart
and purchase
events.
By tracking purchase events and shopping cart updates, you can:
- Track purchase-related insights. For example, you can attribute purchases and revenue to specific campaigns
- Create an abandoned cart campaign when a user adds an item, and after a period of time has not made a purchase.
In this article
How commerce events work
Iterable's commerce events are designed to help you track the items in a user's shopping cart and the items they purchase.
The two commerce events are:
-
updateCart
- An event that updates a user's shopping cart. -
purchase
- An event that tracks a user's purchase, and clears the user's shopping cart.
You can use one or both of these events to track your users' shopping behavior.
These two events work together to manage a user profile object,
shoppingCartItems
, which reflects all of the items in a user's shopping cart.
Step 1: Update a user's shopping cart
When a user adds or removes items from their shopping cart, use the
updateCart
event to send the current contents of the cart.
This updates the shoppingCartItems
to reflect the cart's current status and
adds an updateCart
event to the user's history.
Step 2: Track a purchase
When a user makes a purchase, use the purchase
event, where you can include
all of the items purchased and the total value of the sale.
This empties the shoppingCartItems
on a user's profile and adds a purchase
event to the user's history.
Tracking commerce events
You can track commerce events in Iterable using:
purchase
event fields
Viewing Users who have the Manage Settings project permission can access the Data Schema Management screen to view and manage purchase event fields.
To view and manage the fields for a purchase event, go to Settings > Data Schema Management. Here, you can see each each purchase field, its data type, and when it was created.
Exporting a summary of all purchase fields
You can export a summary of your project's purchase event fields to a CSV file.
The file downloads with the name purchaseF-field-summary.csv
. and contains
the following metadata for each purchase field: Field Name
, System Field
,
Visibility
, Type
, and Created At
.
To export a purchase field summary:
- Go to Settings > Data Schema Management, and click on the Purchase Fields tab.
- Click on the overflow menu (three dots) in the upper right corner of the page and select Export Purchase Fields Summary to CSV.
Adding custom fields to the purchase event
You can add custom fields to a project's purchase event to track additional properties that are important to your business.
To add custom fields to a purchase event's schema:
- Go to Settings > Data Schema Management, and click on the Purchase Fields tab.
- Click New Field
- Enter details for the field you're adding:
- Name: The name of the custom field. To learn about field names, validation rules, and best practices, read Best Practices for Field Names and Event Names.
- Type: The data type of the custom field. To learn about field data types available in this menu, read Field Data Types.
- Description: A description of the custom field. For display in Iterable. (optional)
- Sample Value: An example value for the field. For display in Iterable. (optional)
- Click Save.
Adding a nested field to an object in the purchase event
Nested fields are data fields specific to a given parent field (object), allowing for deeper levels of data.
For example, you could have a user profile field called address
with an
object data type and nested fields for street
, city
, state
, country
,
and zip
.
In Data Schema Management, there are two possible ways to create nested fields: by adding the nested field directly to the parent field, or by manually entering the nested field by referencing its parent field name.
You can only add nested fields to parent fields that already exist and have a data type of object.
NOTE
If you need to create an array of objects, you may need to create a nested data type instead of an object.
To add a nested data type, contact your customer success manager or Iterable support. There is currently no way to create a nested data type using the Iterable app.
To learn more about the differences between nested fields and objects, read Field Data Types.
Method 1 - Adding directly to the parent field
- Go to Settings > Data Schema Management, and select the Purchase Fields tab.
- Find or create the parent field. It must have a data type of object.
- On the far right side of the parent field's row, click New Field.
- Enter the new field's details.
- Name: The name of the nested field. To learn about field names, validation rules, and best practices, read Best Practices for Field Names and Event Names.
- Type: The data type of the nested field. To learn about field data types available in this menu, read Field Data Types.
- Description: A description of the nested field. (optional)
- Sample Value: An example value for the nested field. (optional)
- Click Save.
Method 2 - Adding a nested field with dot notation
You can quickly add nested fields by entering the parent field name followed by
a period (.
) as a delimiter, and then the new field name.
- Go to Settings > Data Schema Management, and select the Purchase Fields tab.
- Click New Field.
- Enter the new field's details.
-
Name: Enter the parent field name followed by a period (
.
), and then the new field name. Example:address.city
. To learn about field names, validation rules, and best practices, read Best Practices for Field Names and Event Names. - Type: The data type of the custom field. To learn about field data types available in this menu, read Field Data Types.
- Description: A description of the nested field. (optional)
- Sample Value: An example value for the nested field. (optional)
-
Name: Enter the parent field name followed by a period (
- Click Save.
Hiding and unhiding purchase event fields
To hide a purchase event field from your project, go to Settings > Data Schema Management.
To hide or show a purchase event field:
- Find the field you want to hide.
- Click the checkbox next to the field name. You can choose multiple fields to hide at once.
- Click Hide or Show.
Another way to selectively hide certain types of purchase event data in Iterable is to use the Show Revenue toggle in Project Settings. To learn more, read Project Settings.
Want to learn more?
For more information about some of the topics in this article, check out this Iterable Academy course. Iterable Academy is open to everyone — you don't need to be an Iterable customer!