product.viewed
Fired when a product is viewed by a customer in the storefront.
Event Structure
{
"event_type": "product.viewed",
"payload": { ... }
}
Payload
{
"id": "6753a1b2c3d4e5f6a7b8c9d0"
}
Payload Fields
| Field | Type | Description |
|---|---|---|
id | string | The ID of the viewed product |
Example Handler
app/routes/webhooks.products.tsx
import { authenticate } from "~/qumra.server";
export async function action({ request }: { request: Request }) {
const { payload, topic, storeId } =
await authenticate.admin(request);
if (topic === "product.viewed") {
console.log(`Product viewed: ${payload.id}`);
// Track analytics, update view count, etc.
}
return Response.json({ success: true });
}