Commerce UA API reference
Commerce UA API reference
Coveo UA command list
Commands | Description | Associated parameters |
---|---|---|
|
Initializes the Coveo Analytics JavaScript |
|
|
Sets the website context or user ID |
|
|
Returns the current version of the tracking library |
|
|
Includes the relevant product data in the event you’re about to send |
|
|
Specifies the action done on this data |
|
|
Sends an event with a given name and payload to the analytics endpoint |
|
Global fields reference
User fields reference
Users fields are related to the current user.
userId
(string)
Example: myuser@mycompany.com
|
Before using the |
currencyCode
(string)
The currency code is a three-letter code that identifies the user’s currency.
The code follows the ISO 4217
standard.
Example: CAD
anonymizeIp
(boolean)
Use this field to anonymize the IP address by removing the last subnet of the current user’s IP address.
Coveo will never store unencrypted IPs, even when this setting is set to false
.
loyaltyCardId
(string)
A unique identifier provided to a returning user.
loyaltyTier
(string)
A level of membership where users receive perks and benefits depending on their rank.
Example: Platinum
thirdPartyPersona
(string)
This represents additional market segmentation based on user characteristics (demographics, interests, needs, or location) which aren’t created by Coveo Machine Learning (Coveo ML). When you already have a set of segments for your users, enter the information in this field.
companyName
(string)
The name of a specific company for business-to-business sales.
favoriteStore
(string)
The primary store selected by a returning user.
storeName
(string)
The name of the current store selected by the user.
userIndustry
(string)
For business-to-business (B2B) environments that need to indicate which industry’s vertical structure the user belongs to (e.g., healthcare,technology, insurance).
userRole
(string)
For business-to-business (B2B) environments that need to indicate the role or title of the current user (e.g., director, manager, specialist).
userDepartment
(string)
For business-to-business (B2B) environments that need to indicate the department of the current user (e.g., IT, Design, Procurement, Sales).
businessUnit
(string) - deprecated
|
This field has been deprecated. You no longer need to send this data when logging analytics events. |
This field defines the current catalog in use. For a solution with multiple catalogs, we use the catalog passed in this field to separate reporting and machine learning between catalogs.
Page fields reference
Page fields are sent using the set
command, or alongside a pageview
event as shown in the following command:
coveoua('send', 'pageview', {
page: '/mypage'
})
page
(string)
The path portion of the page URL that allows users to track pages for single page apps (SPA) and mobile apps.
To send the page
, add the following line before sending the pageview
event, for example:
coveoua('set', 'page', window.location.pathname)
title
(string)
The title of the page. The default value is retrieved from document.title
.
Example: My Super Site
location
(string)
The full URL of the page. The default value is retrieved from document.location
.
Example: https://www.mysupersite.com/home
Global custom fields reference
The custom
field allows users to add additional custom values as an object.
Everything in this field will be unfolded to the parent object and then sent to coveoua
.
To set custom fields for the whole page, use the set
command, passing the custom
string as a second argument, and an object containing the desired key-value pairs as a third argument.
On custom user data
coveoua('set', 'custom', {
visitorAge: 18,
rewardsMember: true
});
// sets the `custom` field for each top-level object
When you use the send
command
coveoua('send', 'pageview');
The following data is sent to coveoua
:
visitorAge: 18,
rewardsMember: true
|
Note
You can use a
Coveo ML Content Recommendation (CR) model
which leverages collect events to render content recommendations.
In this case, all of the |
Product data fields reference
Product fields reference
Product fields are set with the ec:addProduct
command.
name
(string)
Example: Very nice shoe
brand
(string)
Example: Coveo
category
(string)
Represents a grouping of products having particular shared characteristics.
Field format | Examples |
---|---|
Single |
|
Hierarchical |
|
Multi-value |
|
|
Note
The format expected when uploading |
Ensure that you aren’t sending events that include breadcrumbs with temporary categories or events, such as sales
or clearance
items.
group
(string)
Represents an ID that’s specific to an item that has multiple SKUs attached to it. This is useful if you only want one item per group to be recommended by the machine learning algorithms.
|
Note
When you structure your items with product grouping, ensure you add the Using the recommended approach for product data, you would find, for example, |
variant
(string)
A string that defines the unique non-displayable version of the product. Often called a stock keeping unit (SKU).
Example: 001-red-8_wide
|
Note
If the For example, when a user lands on a product detail page where a |
price
(Monetary values)
The price of the product.
Price values are only meaningful if accompanied by a currencyCode
.
Example: 12.34
quantity
(numeric)
Quantity of the product bought.
Example: 12
coupon
(string)
The name of the coupon used on this specific product.
Example: PROMO-1234
position
(numeric) - deprecated
|
This field has been deprecated. You no longer need to send this data when logging analytics events. |
The item’s position.
For example, the first item displayed in a list should have position: 1
.
Example: 2
|
Note
For products, only a position greater than or equal to |
Transaction fields reference
Transaction fields are set with coveoua('ec:setAction', <ACTION>)
id
(string)
An identifier used to track a specific transaction.
Example: transaction-1234
affiliation
(string)
The store where a transaction took place. Sent when you want to link a purchase
or refund
to a specific store.
Example: Shoe Store
revenue
(Monetary values)
The total value of the transaction, including taxes and shipping.
Example: 123.21
coupon
(string)
The name of the coupon used on the whole transaction.
Example: PROMO-FREE-SHIPPING-2020
Quote fields reference
Field references related to providing a quote to the user.
id
(numeric)
An identifier used to track a specific transaction.
affiliation
(string)
The store where a quote took place. Sent when you want to link a quote
to a specific store.
Example: Shoe Store
Review fields reference
Review fields provide customers the opportunity to rate and comment on products they have purchased.
id
(numeric)
An identifier used to track a specific transaction.
rating
(numeric)
A rating described on a numeric scale from 0 to 10.
|
Note
When using a different rating method, for example a review of 0 to 5 stars, ensure you convert the score to a 0 to 10 scale. |
comment
(string)
A written summary of a user’s experience with a product or service.
Product data custom fields reference
The custom
field allows users to add additional custom values as an object.
Everything in this field will be unfolded to the parent object and then sent to coveoua
.
To set custom fields in a product impression, use the ec:addProduct
command, and add a custom
object containing the desired key-value pairs in your main product impression object.
On custom product data, when you use the ec:addProduct
command
coveoua('ec:addProduct', {
'id': '001-red',
'name': 'A very nice pair of shoes',
'brand': 'Coveo',
'category': 'Running shoes',
'price': 90.22,
'variant': '001-red-8_wide',
'custom' : {
'onSale' : false
}
});
When you use the send
command
coveoua('send', 'event');
It will send the following data
id: '001-red',
name: 'A very nice pair of shoes',
brand: 'Coveo',
category: 'Running shoes',
price: 90.22,
variant: '001-red-8_wide',
onSale : false
Product action type reference
Action | Description |
---|---|
|
The user clicked on a product. |
|
The user accessed a detailed view of the product. |
|
The user accessed a quick view of the product. |
|
The user added or removed a product from their cart. |
|
The sale or return of one or more products. |
|
The user added or removed a product from their bookmark. |
|
The user added a product to compare to another or removed one. |
|
The user added or removed a review on a product. |
|
The user asked for a quote regarding a given product (e.g., asked for a price on a large quantity of products in return for a discount). |
|
The user initiated the checkout process for one or more products. |
|
The user selected an option value for a given checkout step (e.g., selecting payment options or shipping methods). |
Monetary values
Currency is a specification of a monetary amount. The following table lists the acceptable currency data types.
Currency data type | Examples |
---|---|
A positive or negative integer. |
|
A positive or negative decimal value with up to 6 decimal places using |
|
A string, which may contain a non-numeric prefix in front of an integer or decimal value.
In this case, Coveo interprets the number by stripping away the prefix up to the first numeric, |
Acceptable strings include |
|
Note
Coveo doesn’t support numbers using different decimal separators other than |
Search hub
The name or identifier of the search interface from which a given UA event originates.
Depending on the type of interface from which the event originates, the value of the search hub must contain:
Type of interface | Contains the string |
---|---|
A search page |
|
A product listing page |
|
|
Note
For recommendation components, the attribution mechanism is automatically managed by tracking a unique ID throughout the actions leading to a product being added to a cart or purchased.
Therefore, there’s no specific naming convention to use when choosing a search hub value for your recommendation component, but note that it’s a good practice to add However, the identifier value of the recommendation component is used for reporting purposes.
Specifically, the Coveo UA service utilizes the To ensure clarity and easy recognition, we strongly recommend assigning a meaningful and recognizable value as the identifier for your recommendation component. You can achieve this by setting the |
For page views:
coveoua('send', 'pageview', {
"searchHub": "<SEARCH_HUB>"
});
For other events:
coveoua('send', 'event', {
"searchHub": "<SEARCH_HUB>"
});
Where <SEARCH_HUB>
is the name of your search hub (e.g., "storefront_search" for a search page or "MyBrand_listing" for a product listing page).
If searchHub
isn’t specified and the request is authenticated with a search token, the service tries to extract the searchHub
value from the access token that authenticated the request to log a search event (see Set the Search Hub).
|
Coveo ML models use the |