Order tag
The order tag tells Humind about each order placed on your store, from your order confirmation page. Humind then knows which orders the assistant had a hand in, and for how much: it is the equivalent of the transaction tag of other conversational tools, set up the same way in your tag manager.
You need it if your store has no server-side order source connected to Humind. Shopify stores (orders come from the Humind app), PrestaShop stores (orders come from the Humind module) and stores that push their orders through the Orders API from a custom back office do not: the tag is ignored on them, so an order is never counted twice.
What Humind does with an order
For each order, Humind decides whether the assistant had a hand in it, from what the widget left in the shopper's browser:
| Verdict | Meaning |
|---|---|
Added through Humind (direct) | At least one product of the order was added to the cart from the assistant. |
Recommended (recommended) | The shopper added it by themselves, but the assistant had shown or cited that product in their conversation. |
Conversation (cart) | The shopper talked to the assistant, then bought products the conversation never showed. |
| None | No conversation in this browser. The order still counts in your store's total. |
Attributed revenue only sums the products Humind had a hand in (added through Humind or recommended), never the rest of the basket.
Set it up in Google Tag Manager
You need your Humind company id: copy it from the Developer Credentials page of your dashboard. With several markets, use the id of the market the confirmation page belongs to.
- Variables: create Data Layer Variables for your purchase event, typically
ecommerce.transaction_id,ecommerce.value,ecommerce.currencyandecommerce.items(the GA4 e-commerce format). - Trigger: the event that fires on your order confirmation page, usually your
purchaseevent. - Tag: a Custom HTML tag fired by that trigger:
<script>
window.humindOrder = {
company: 'YOUR_COMPANY_ID',
orderId: {{DLV - ecommerce.transaction_id}},
total: {{DLV - ecommerce.value}},
currency: {{DLV - ecommerce.currency}},
items: {{DLV - ecommerce.items}}
};
</script>
<script async src="https://embed.thehumind.com/order.js"></script>Rename the variables to the names you use. Other tag managers: set the same window.humindOrder object, then load the same script.
| Field | Required | Content |
|---|---|---|
company | yes | Your Humind company id. |
orderId | yes | The order number as your store numbers it (128 characters at most). |
total | yes | Total paid for the order, in major units (129.90), between 0 and 1,000,000. A number, or a string in the usual formats (89,90, 1 234,56, 1,234.56). A lone dot is always the decimal point: write 1.234,00 or 1234, not 1.234, for one thousand two hundred and thirty-four. |
currency | no | ISO 4217 code (EUR). Ignored if it is not three letters. |
items | no, recommended | The ordered products, GA4 format: item_id, price, quantity, item_name, item_variant. 200 at most. A line with no item_id is skipped, a price that cannot be read is left empty: the order is still recorded. |
Without items, Humind still knows the shopper talked to the assistant, but not which products came from it: the order can only get the Conversation verdict.
item_id must be the reference of your catalog feed
Humind recognizes a product by the reference your catalog feed sends it (the product id, or the variant reference you send as an external id). If your data layer uses another identifier in item_id, the products are not recognized: the order is recorded, but neither Added through Humind nor Recommended.
Test it
- On your site, open the assistant and add a product to the cart from it.
- Place a test order.
- On the confirmation page, open the browser's network tab: a request to
api.thehumind.com/integrations/order-tag(typeping) answers201. When the browser shows its body, it reads{"recorded": true, "attribution": "direct"}.
Other answers:
| Status | reason | Meaning |
|---|---|---|
200 | already_recorded | This order number is already recorded (confirmation page reloaded). Nothing changed. |
202 | server_orders | Your store already sends its orders from its server (Shopify, PrestaShop, Orders API): the tag is ignored. |
400 | invalid_payload | A required field is missing or malformed. |
403 | origin_not_verified | The page is not on a verified domain of your company. Verify it on the URL whitelist page of your dashboard. |
404 | unknown_company | company is not a Humind company id. |
413 | too_large | The body is over 64 KB. order.js never sends one: it drops the product names, then the last lines, so the order number and the total always leave. |
429 | rate_limited | Over 5,000 new orders an hour from the same connection: a ceiling against scripts that no real shopper reaches. There is no limit on your store's total. |
On localhost, the tag works only while your company's localhost test window is open, and the order is recorded as a test, out of every figure.
Good to know
- The page must be on a verified domain of your company: a tag sent from another site is refused.
- An order is recorded once. A reloaded confirmation page or a tag fired twice changes nothing. If your server later pushes the same order number through the Orders API, that push replaces it.
- Cancellations and returns are not known through the tag: it only sees the confirmation page. A store that needs them pushes its orders from its server through the Orders API instead of the tag (the tag is then ignored).
- The trace lives in the shopper's browser: another device, cleared cookies or a conversation older than 30 days, and the order is recorded without attribution.
- Consent: the widget always notes in its
humind_attributioncookie the products added from the assistant, which identify no one. The visitor and conversation identifiers go in only when usage measurement is allowed, and are erased when the shopper refuses. If you require consent in Humind, an order placed without it can still be Added through Humind, but not Recommended nor Conversation. On PrestaShop, the identifiers are always written, as the Humind module needs them. Details: Privacy and browser storage.