انتقل إلى المحتوى

لم يُكتب وصف هذه العملية بالعربية بعد، فأوصافها بالإنجليزية.

Track events

POST/store/v1/analytics/events
  • يدعم Idempotency-Key

Record what a shopper did on a headless storefront, for the store's conversion funnel: page_view, product_view, add_to_cart, checkout_started, checkout_completed. Send events in batches (up to 50) with anonymous visitor and session IDs. Bots, shoppers who opted out (DNT: 1, Sec-GPC: 1, consent: false) and events older than a day are discarded, not refused. Limited to 300 batches per minute per client address.

الترويسات

  • Idempotency-Keystring

    أرسل المفتاح نفسه لإعادة المحاولة بأمان: تُعاد الإجابة الأولى لمدة ٢٤ ساعة.

  • shop-api-versionYYYY-MM

    الإصدار الذي تُكتب به الإجابة. بدونه يُستخدم الإصدار المثبّت لتطبيقك، وإلا الأحدث.

الجسم

  • visitor_idstringمطلوب

    A random UUID the storefront keeps per browser (a long-lived first-party cookie or local storage). Never a customer ID, email or anything else that names a person.

  • session_idstringمطلوب

    A random UUID per visit, renewed after 30 minutes without activity.

  • eventsarray of objectsمطلوب

    1–50 events, oldest first.

  • consentboolean · أو null

    The shopper's answer on the storefront's consent banner, if it has one: false records nothing. DNT: 1 and Sec-GPC: 1 request headers are honoured the same way.

  • landingobject · أو null

    The visit's landing page and referrer: send them with the visit's first batch, so its traffic source and campaign are known.

ما يُرجعه

202 Queued.

الأخطاء

  • 401unauthenticatedMissing or invalid publishable key.
  • 422validation_failedInvalid batch.
  • 429rate_limitedToo many batches.