Skip to main content

Track ad events

POST /v2/ian/track

Sends ad-related events from a retailer's site to Instacart. Events capture user actions such as clicks, add-to-cart actions, backend served impressions, and frontend viewport impressions (1 pixel and viewable). The events are used for billing, generating metrics, training machine learning models, and auditing purposes.

Events types

The following table lists the supported event types for each ad type:

Ad typeValues
Sponsored product
  • ian.sponsored_product.viewable_in_viewport
  • ian.sponsored_product.begin_to_render_viewport
  • ian.sponsored_product.1px_in_viewport
  • ian.sponsored_product.clicked
  • ian.sponsored_product.added_to_cart
Display banner
  • ian.display.click_creative
  • ian.display.viewport_load_creative
  • ian.display.viewport_1px_creative
  • ian.display.viewport_viewable_creative
  • ian.display.viewport_viewable_creative_asset
  • ian.display.viewport_viewable_begin_to_render_creative
  • ian.display.viewport_viewable_begin_to_render_creative_asset
Shoppable display
  • ian.display.click_creative
  • ian.display.viewport_load_creative
  • ian.display.viewport_1px_creative
  • ian.display.viewport_viewable_creative
  • ian.display.viewport_viewable_creative_asset
  • ian.display.viewport_viewable_begin_to_render_creative
  • ian.display.viewport_viewable_begin_to_render_creative_asset
Shoppable display item
  • ian.display.add_creative_item
  • ian.display.click_creative_item
  • ian.display.viewport_1px_creative_item
  • ian.display.viewport_viewable_creative_item

Security

NameInDescription
AuthorizationheaderThe Authorization header with the bearer token acquired during authentication.

Parameters

NameInTypeRequiredDescription
X-Retailer-IdheaderstringOptionalThe retailer slug. This is only required for a retailer with multiple banners. Retailers with single banners can leave this empty.

Request

FieldTypeRequiredDescription
eventstringRequiredThe type of the event. Supported values for SP: ['ian.sponsored_product.viewable_in_viewport', 'ian.sponsored_product.begin_to_render_viewport', 'ian.sponsored_product.1px_in_viewport', 'ian.sponsored_product.clicked', 'ian.sponsored_product.added_to_cart']. Supported values for display banner: ['ian.display.viewport_load_creative', 'ian.display.viewport_1px_creative', 'ian.display.viewport_viewable_creative', 'ian.display.viewport_viewable_creative_asset', 'ian.display.click_creative', 'ian.display.viewport_viewable_begin_to_render_creative', 'ian.display.viewport_viewable_begin_to_render_creative_asset']. Supported values for shoppable display: ['ian.display.viewport_load_creative', 'ian.display.viewport_1px_creative', 'ian.display.viewport_viewable_creative', 'ian.display.viewport_viewable_creative_asset', 'ian.display.click_creative', 'ian.display.viewport_viewable_begin_to_render_creative', 'ian.display.viewport_viewable_begin_to_render_creative_asset']. Supported values for shoppable video: ['ian.display.viewport_load_creative', 'ian.display.viewport_1px_creative', 'ian.display.viewport_viewable_creative', 'ian.display.click_creative', 'ian.display.viewport_viewable_begin_to_render_creative_asset', 'ian.display.viewport_video_begin_to_render', 'ian.display.viewport_1px_video', 'ian.display.viewport_video_viewable']. Supported values for shoppable display item: ['ian.display.add_creative_item', 'ian.display.click_creative_item', 'ian.display.viewport_1px_creative_item', 'ian.display.viewport_viewable_creative_item']. Supported values for shoppable video item: ['ian.display.add_creative_item', 'ian.display.click_creative_item', 'ian.display.viewport_1px_creative_item', 'ian.display.viewport_viewable_creative_item'].
dataEventDataOptionalThe data of the event. Required for retailers. Optional for third-party partners.
user_idstringRequiredThe unique user ID. Maximum 50 characters.
sent_atstringRequiredThe time when the client fired the event. Use ISO8601 format with the time zone designator (TZD) appended. Example: 2022-12-03T10:15:30+08:00.

EventData Object

FieldTypeRequiredDescription
sponsored_product_dataFeaturedProductEventPropertiesOptionalSpecify only one of the options described in this table. This option retrieves event data for sponsored product events.
display_banner_dataDisplayBannerEventPropertiesOptionalSpecify only one of the options described in this table. This option retrieves event data for display events.
shoppable_display_dataShoppableDisplayEventDataOptionalSpecify only one of the options described in this table. This option retrieves event data for shoppable display events.
shoppable_video_dataShoppableVideoEventDataOptionalSpecify only one of the options described in this table. This option retrieves event data for shoppable video events.
shoppable_display_item_dataShoppableDisplayItemEventDataOptionalSpecify only one of the options described in this table. This option retrieves event data for shoppable display item events.
shoppable_video_item_dataShoppableVideoItemEventDataOptionalSpecify only one of the options described in this table. This option retrieves event data for shoppable video item events.

FeaturedProductEventProperties Object

FieldTypeRequiredDescription
event_tracking_contextEventTrackingContextRequiredCommon context about the event.
event_idstringOptionalThe UUID (Universal Unique Identifier) for the event.
object_tracking_idstringOptionalThe tracking ID of the ad that was clicked on.
display_positionstringRequiredThe position of the sponsored product in the item grid.
organic_positionstringOptionalThe original position of the organic item that was deduped by the sponsored product.
format_typestringOptionalThe format of the sponsored product that was shown.
product_idstringOptionalThe product ID of product shown as a sponsored product. This is the same as the product ID returned in the sponsored product response for an ad item.
pagestringOptionalThe page on which the sponsored product was shown, where the first page is 1. The value must be greater than 0.
block_numberstringOptionalThe sequential block number of which the sponsored product was a part.
record_versionstringRequiredThe version of the event record. Set to 1 for production events. Set to 999 for testing events. Any other value returns an error code.
page_view_idstringRequiredThe page view ID where the ad was shown.

EventTrackingContext Object

FieldTypeRequiredDescription
user_agentstringRequiredThe user agent of the device making the request.
user_ipstringRequiredThe IP address of the end user.

DisplayBannerEventProperties Object

FieldTypeRequiredDescription
event_tracking_contextEventTrackingContextRequiredCommon context about the event.
object_tracking_idstringOptionalThe tracking ID of the display ad.
creative_typestringRequiredType of the creative.
interaction_idstringOptionalRepresents a unique identifier of the action instance rendered in a client and interacted with. This field is required for the following events: ['ian.display.click_creative'].
page_view_idstringRequiredUnique identifier of a page view.
search_termstringOptionalSearch term associated with the request.
event_idstringOptionalThe unique uuid for the event.
record_versionstringOptionalThe version of the event record. Set to 1 for production events. Set to 999 for testing events. Any other value returns an error code.
asset_typestringOptionalThe asset type of the event from the “type” field of the asset object in the display ads response. Required for events at the asset level (ex: 'ian.display.viewport_viewable_begin_to_render_creative_asset' and 'ian.display.viewport_viewable_creative_asset').

ShoppableDisplayEventData Object

FieldTypeRequiredDescription
event_tracking_contextEventTrackingContextRequiredCommon context about the event.
event_idstringRequiredThe unique uuid for the event.
object_tracking_idstringRequiredThe tracking ID of the display shoppable ad.
record_versionstringRequiredThe version of the event record. Set to 1 for production events. Set to 999 for testing events. Any other value returns an error code.
page_view_idstringRequiredUnique identifier of a page view.
interaction_idstringOptionalRepresents a unique identifier of the action instance rendered in a client and interacted with. This field is required for the following events: ['ian.display.click_creative'].
creative_typestringRequiredThe creative type of the event from the “type” field of the creative object in the display ads response.
asset_typestringOptionalThe asset type of the event from the “type” field of the asset object in the display ads response. Required for events at the asset level (ex: 'ian.display.viewport_viewable_begin_to_render_creative_asset' and 'ian.display.viewport_viewable_creative_asset').

ShoppableVideoEventData Object

FieldTypeRequiredDescription
event_tracking_contextEventTrackingContextRequiredCommon context about the event.
event_idstringRequiredThe unique uuid for the event.
object_tracking_idstringRequiredThe tracking ID of the display shoppable ad.
record_versionstringRequiredThe version of the event record. Please use 1 for production events and 999 for testing events.
page_view_idstringRequiredUnique identifier of a page view.
interaction_idstringOptionalRepresents a unique identifier of the action instance rendered in a client and interacted with. This field is required for the following events: ['ian.display.click_creative'].
creative_typestringRequiredThe creative type of the event from the “type” field of the creative object in the display ads response.
asset_typestringOptionalThe asset type of the event from the “type” field of the asset object in the display ads response. Required for events at the asset level (ex: 'ian.display.viewport_viewable_begin_to_render_creative_asset' and 'ian.display.viewport_viewable_creative_asset').

ShoppableDisplayItemEventData Object

FieldTypeRequiredDescription
event_tracking_contextEventTrackingContextRequiredCommon context about the event.
event_idstringRequiredThe unique uuid for the event.
object_tracking_idstringRequiredThe tracking ID of the display shoppable ad.
record_versionstringRequiredThe version of the event record. Set to 1 for production events. Set to 999 for testing events. Any other value returns an error code.
page_view_idstringRequiredUnique identifier of a page view.
interaction_idstringOptionalRepresents a unique identifier of the action instance rendered in a client and interacted with. This field is required for the following events: ['ian.display.add_creative_item', 'ian.display.click_creative_item'].
creative_typestringRequiredThe creative type of the event from the “type” field of the creative object in the display ads response.
product_idstringRequiredThe product ID corresponding to the display shoppable ad event.

ShoppableVideoItemEventData Object

FieldTypeRequiredDescription
event_tracking_contextEventTrackingContextRequiredCommon context about the event.
event_idstringRequiredThe unique uuid for the event.
object_tracking_idstringRequiredThe tracking ID of the display shoppable ad.
record_versionstringRequiredThe version of the event record. Please use 1 for production events and 999 for testing events.
page_view_idstringRequiredUnique identifier of a page view.
interaction_idstringOptionalRepresents a unique identifier of the action instance rendered in a client and interacted with. This field is required for the following events: ['ian.display.add_creative_item', 'ian.display.click_creative_item'].
creative_typestringRequiredThe creative type of the event from the “type” field of the creative object in the display ads response.
product_idstringRequiredThe product ID corresponding to the display shoppable ad event.

Request examples

curl --request POST \
--url https://connect-ian.instacart.com/v2/ian/track \
--header 'Accept: application/json' \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--header 'User-Agent: string' \
--header 'X-Retailer-Id: string' \
--data '{
"event": "string",
"data": {
"sponsored_product_data": {
"event_tracking_context": {
"user_agent": "string",
"user_ip": "string"
},
"object_tracking_id": "string",
"display_position": "string",
"organic_position": "string",
"format_type": "item_card",
"product_id": "string",
"page": "string",
"block_number": "string",
"record_version": "string",
"page_view_id": "string"
}
},
"user_id": "string",
"sent_at": "string"
}'

Response

FieldTypeRequiredDescription
messagestringRequiredResponse for the user.

Response examples

200 Success

{
"message": "Successfully processed"
}

4XX Errors

Error responses return either a single error or multiple errors.

HTTP CodeCauseError MessageError CodeError Meta
400Missing event data*"There were issues with your request"9999Not applicable
400Extra event data*"There were issues with your request"9999Not applicable
400No event params"Couldn't find user_id in the request"4001Not applicable
400Missing event context"can't be blank"1001{"key":"data.shoppable_video_item_data.event_tracking_context"}
400Invalid ad id"must be a UUID"1001{"key":"data.sponsored_product_data.ad_id"}
400Invalid display position"is not a number"1001{"key":"data.sponsored_product_data.display_position"}
400Invalid organic position"Invalid organic position given."1001{"key":"data.sponsored_product_data.organic_position"}
400Invalid format type"is not included in the list"1001{"key":"data.sponsored_product_data.format_type"}
400Invalid product id"is not a number"1001{"key":"data.sponsored_product_data.product_id"}
400product_id can't be a decimal"must be an integer"1001{"key":"data.sponsored_product_data.product_id"}
400product_id is a number under 1"must be greater than or equal to 1"1001{"key":"data.sponsored_product_data.product_id"}
400Invalid search id"must be a UUID"1001{"key":"data.sponsored_product_data.search_id"}
400Invalid event name"Invalid event name Clicked an ad"1001{"key":"data"}
400Invalid page type"is not included in the list"1001{"key":"data.display_banner_data.page_type"}
400Invalid placement type"Improper placement reported for search"1001{"key":"data.sponsored_product_data"}
400Invalid platform"is not included in the list"1001{"key":"data.display_banner_data.platform"}
400Invalid block number"is not a number"1001{"key":"data.sponsored_product_data.block_number"}
400Invalid record version type"is not a number"1001{"key":"data.sponsored_product_data.record_version"}
400Invalid page view ID"must be a UUID or 'None'"1001{"key":"data.sponsored_product_data.page_view_id"}
400Invalid mgs correlation ID"must be a UUID"1001{"key":"data.sponsored_product_data.mgs_correlation_id"}
400Improper placement for search"Improper placement reported for search"1001{"key":"data.sponsored_product_data"}
400User agent is too long"is too long (maximum is 1000 characters)"1001{"key":"data.sponsored_product_data.event_tracking_context.user_agent"}
400Tracked brand page view event with item/product id"Item/product id should be empty for client brand page view event type"1001{"key":"data"}
400Tracked brand page click with no item/product id"Item/product id field should not be empty"1001{"key":"data"}
400Invalid UUID field"must be a UUID"1001{"key":"data.brand_page_data.session_token"}
400Invalid UUID for interaction id"must be a UUID"1001{"key":"data.shoppable_video_item_data.interaction_id"}
400Invalid creative type"is not included in the list"1001{"key":"data.shoppable_video_item_data.creative_type"}
400Invalid asset type"is not included in the list"1001{"key":"data.shoppable_display_data.asset_type"}
400Invalid UUID for event id"must be a UUID"1001{"key":"data.shoppable_video_item_data.event_id"}
400Missing product id"can't be blank"1001{"key":"data.shoppable_video_item_data.product_id"}
* Multiple error