Docs / Desarrolladores
Este artículo se muestra en inglés.
Behavior events
The SDK track() method posts named events to POST /v1/behavior-events with your site key. Use this for product views, cart updates, and similar shopper signals.
Commerce Nudges that consume these events (cart, back in stock, price drop) are off by default. Sending events does not turn those automations on.
From the SDK
window.EngageNudge.track("product.viewed", { externalId: "1042", sku: "HOODIE-M" });
window.EngageNudge.track("cart.updated", { externalId: "1042", sku: "HOODIE-M" });If you use the GTM commerce template, it maps GA4 ecommerce dataLayer events into track().
Who the event belongs to
When the visitor is a push subscriber, track() adds their subscription id to the event by itself (SDK 1.0.1 and later). You do not look it up or pass it. For a visitor who has not subscribed, the event is sent without one.
Back in stock depends on this. A product.viewed or cart.updated that carries a subscription id records that this subscriber is interested in the product, matched on sku (or externalId when there is no sku). Send the same sku in your product.stock_changed event. Events sent from a server, such as a webhook or a PHP hook, know the product and not the person, so they do not record interest.
If your site requires consent (data-require-consent="true"), track() sends nothing until consent is granted.
HTTP
POST /v1/behavior-events on the API host. Authenticate with the site key the SDK already uses. Schema-validate on our side. Do not send passwords, payment details, or other secrets in properties.
Keep externalId stable (SKU or product id). That is how later automations will join events to a product.