Track a product click with npm
This tutorial demonstrates how to track a ProductClicked event when a user clicks on a product in the webshop.
Before you start
Set up the npm client as described in the developer overview.
Step 1: Track the product click
Call trackProductClicked with the product and SKU identifiers:
The categoryId field is optional. Provide it when available to improve ranking and recommendation signals.
Step 2: Verify
Events are batched and sent automatically. The tracker flushes when the batch size is reached or the batch interval expires. A successful submission results in a 202 Accepted response from the Event Receiver.
Complete example
Warning
Please keep in mind that all examples provided are for illustrative purposes only. They are not intended to represent best practices and should not be used in production without a thorough code review.