Product Events let you track how contacts interact with your products, for example when they view an item, add it to the cart, or complete a purchase. You can then use this data in automations, segments, and analytics to better understand customer behavior and personalize communication.
This article explains how to send product events and what rules you need to follow to make sure the data is stored correctly.
To know more about product events, please check “What Is a Product Event” article.
There are 2 options to send product events to User.com:
Javascript SDK
REST API
In general, sending product events is pretty similar to sending standard events. However, there are few aspects you need to pay attention to:
Use the keyword product_event while sending a product event.
Include required attributes: “product_id” and “event_type”
Passing the product name is optional. If you do not include it and the product does not already exist, the product will be created without a name.
Event type list is closed. You cannot add new ones. Available options are:
click
promo click
view
detail
liking
add to observation
reservation
add
add to cart
remove
checkout
checkout option
order
purchase
return
refund
You can include product attributes, such as the “product name”, “category”, or any other custom attributes you need.
User.com does not store historical values of product event attributes (except event_type). Each new product event updates the current attribute values on the product profile. This means older values are overwritten.
Because product attributes always reflect the latest value, you won’t be able to track differences between variants within a single product. If you need to distinguish between variations (such as the same shoes in different sizes) create a separate product for each variant and assign each one a unique product_id.
To keep your data structured and easy to work with, it’s recommended to create product attributes before sending them to the system. This ensures you can assign the correct data type in advance (such as integer, boolean, date, and more).
If an attribute is sent without being predefined, it will be created automatically as a string. This may reduce filtering accuracy and limit your segmentation and reporting capabilities later on.
To see the available attribute types and select the best option for your needs, please refer to the following article.
REST API endpoints to send a product event:
Below is an example of sending a product event using the REST API:
curl -X POST
"https://<your_app_subdomain>.user.com/api/public/products-by-id/"
-H 'authorization: Token <your_64_char_api_key>'
-H 'content-type: application/json'
-d '{
"name": "my product",
"custom_id": "my_product_id",
"product_url": "https://myshop.com/products/my_product/",
"image_url": "https://myshop.com/media/products/myproduct.jpg"
}'If you send a product event without providing a name, the system will first check whether a product with the given “product_id” already exists.
If no matching product is found, a new product will be created using that “product_id”, but it will be saved without a name.
You can also trigger a Product Event directly from HTML, for example when a contact clicks a button or link.
<a href="#"
onclick="userengage('product_event', {
product_id: 'the_id',
event_type: 'add to cart',
name: 'product name',
my_attribute: 'value',
my_attribute_2: 'value_2'
})">
CLICK ME!
</a>For better data organization and long-term flexibility, it’s strongly recommended to create product attributes before sending them to the system. Defining attributes in advance allows you to set the correct data type (such as integer, boolean, date, etc).
If attributes are not predefined, they will be automatically created with the string data type. This can make filtering less precise and limit your segmentation and reporting options in the future.
To review the available attribute types and choose the right one for your use case, please refer to the following article.
To send product events using the JavaScript method, make sure the request includes the required parameters.
Required fields:
product_id
event_type
Optional fields:
name
description
Any additional product event attributes relevant to your use case
For the “event_type”, select one of the predefined values listed earlier in this article.
Example:
userengage("product_event", {
product_id: "12345",
event_type: "add to cart",
name: "Product Name",
description: "Product description"
});Understand customer interest and buying intent: Track key actions such as product views, clicks, add-to-cart events, and purchases to better understand what customers are interested in and where they drop off in the buying journey.
Increase conversions with real-time automated follow-ups: Use product events to trigger automations based on customer behavior. For example, sending reminders or offers when a contact adds an item to the cart but doesn’t complete the purchase.
Create more accurate segments for targeted marketing: Build segments based on real product interactions to reach the right audience with relevant messages, such as customers who viewed a specific product or showed interest in a particular category.
Measure product engagement and optimize performance: Analyze product event data over time to evaluate product popularity, track engagement trends, and identify high-performing or underperforming products for better marketing and sales decisions.
Increase revenue with personalized product recommendations: Use purchase events to recommend relevant products based on what customers have already bought. This allows you to run dedicated campaigns that promote complementary or similar items, encouraging repeat purchases and increasing average order value.
Use appropriate data types for attributes to maintain accuracy and consistency. For example, set “Price” as “float” to prevent errors.
Customize your product data by adding attributes that align with your business needs, allowing for more precise tracking and analysis.
By managing your products strategically, you can unlock valuable insights and improve the effectiveness of your marketing and engagement strategies.
What Is a Product
Product Feed Introduction