Skip to main content

Report impressions, clicks and sales

Events let GoWit attribute sales and actions like add to cart to ads, and update campaign metrics. They use the same API key header as ad requests.

POST /server/events · Full reference

FieldTypeRequiredDescription
domain_idintegerYesYour domain id: the number of your market on GoWit. GoWit shares it with your host and keys. Stage and production use their own values.
event_typestringYesWhat happened. Besides the four built-in kinds, any custom kind your market registered is accepted, e.g. add_to_cart. An unregistered name is refused. See custom events. One of impression, viewable_impression, click, sale, <custom kind>.
session_idstringWhen online eventsThe same session_id sent in the ad request. Required for every event except a sale whose lines are all OFFLINE.
ad_idtokenWhen impression, clickThe ad_id from the ad response, unchanged. Required for clicks; for impressions send ad_id or ad_ids. Not read on sales.
salesobject[]When saleThe order lines. One sale event is one whole order.
order_idstringNoYour order id. Recommended: it keeps one order from counting twice when you retry.

Automatic impressions​

Automatic impressions shorten the integration. In the console Setup center, under Measurement › Tracking, set Who records impressions to On serve. Every ad in an ad response then counts as an impression, and you send no impression events. The default is Your storefront.

Impressions​

Send an impression event when the returned ads are shown on the page. Skip it when impressions are recorded on serve. Several ads seen together can go in one event with ad_ids.

Clicks​

Send a click event as soon as a shopper clicks a displayed ad. The click starts the attribution window for the sales that follow.

Sales​

Send every order, whether or not it looks ad-driven. GoWit matches each sale to ads by the shopper’s session_id or customer_id. The attribution model of the campaign’s ad format decides which sales count.

A sale event carries a sales array instead of an ad_id. Each line names the seller_ref, product_id, quantity and unit_price. One sale event is one whole order, of up to 1,000 lines.

curl --request POST 'https://xxx.edge-stage.gowit.app/server/events' \
--header 'Authorization: YOUR_API_KEY' \
--header 'Content-Type: application/json' \
--data '{
"domain_id": 1001,
"event_type": "impression",
"ad_id": "AbX3kQ9rT2vLm8...wP4n",
"session_id": "ec07083a-8bf812"
}'
product_id

product_id in a sale is the product’s id from the catalog push, never its sku. order_id is optional but keeps a retried order from counting twice.

Offline sales​

In-store sales use the same event. Set channel to OFFLINE on each line in sales, and send sale_date and the store’s location_id on the event. A store code your market does not have counts nothing.

Custom events​

Impressions, clicks and sales are built in. Other shopper actions can be sent as custom event kinds: add to cart, add to wishlist, video start, sign-up or anything else you track. Each kind is registered for your market in the console’s metric catalog (GoWit sets them up with you on stage), and from then on it is accepted on the same endpoint with its own event_type.

Eventevent_typeNotes
ImpressionimpressionBuilt in. Optional when impressions are recorded on serve.
Viewable impressionviewable_impressionBuilt in. The ad was actually in view.
ClickclickBuilt in. Starts the attribution window.
SalesaleBuilt in. One event per order, up to 1,000 lines.
Add to cartadd_to_cart (alias atc)Custom kind, once registered. Can be credited to ads like a sale.
Your owne.g. wishlist_addCustom kind, once registered. Lowercase letters, digits and _.

A custom event carries the shopper’s session_id, and can name the ad (ad_id), the product (seller_ref + product_id), a quantity, a sale_amount and your own numeric custom_values. Send a line_id so a retry is recognised as the same event.

{
"domain_id": 1001,
"event_type": "add_to_cart",
"session_id": "ec07083a-8bf812",
"ad_id": "AbX3kQ9rT2vLm8...wP4n",
"seller_ref": "ADV001",
"product_id": "P30001",
"quantity": 1,
"sale_amount": 129.99,
"line_id": "cart-7731-1"
}
Not registered?

An event_type your market has not registered is refused with a 400. Ask GoWit to register the kinds you want to send before testing them.

Check that events reach your campaigns​

A 200 with an empty body means only that the event was taken. Whether it counts is decided afterwards, and the event log shows each event’s verdict and reason.

Checklist

  • An impression event raises the impression count by 1 (when your storefront records impressions). (Retailer)
  • A click event raises the click count by 1. (Retailer)
  • Sponsored products: a sale of that product in the same session, after the ad was shown, adds its quantity and amount. (Retailer)
  • Sponsored display: a sale in the same session after the ad was shown raises the creative’s sales. (Retailer)
  • Events that did not count are checked in the event log. (GoWit)
Why it matters

Sales are matched to ads by session_id. Send the same session_id in the ad request, the impression, the click and the sale. Otherwise only a matching customer ID can attribute the sale.