v1.0.0
OpenAPI 3.1.0

Track an anonymous event

US region

Client Libraries

Track an anonymous event

An anonymous event represents a person you haven't identified yet. When you identify a person, you can set their anonymous_id attribute. If event merging is turned on in your workspace, and the attribute matches the anonymous_id in one or more events that were logged within the last 30 days, we associate those events with the person. If you associate an event with a person within 72 hours of the timestamp on the event, you can trigger campaigns from the event.

There are three possible event type values: page, screen and event. Page and screen events represent website page views and mobile app screen views respectively; the name for these event types is intended to be the page or screen a person visited or viewed. Any other event, is given the event type.

Note: Avoid using names with leading or trailing spaces, because you can't reference event names with leading or trailing spaces in campaigns, etc. In workspaces created after September 21, 2021, we trim leading and trailing spaces from event names automatically to fix this issue.

Body
application/json
  • An event attributed to an unknown person. If you provide an anonymous_id with the event, you can associate the event with a person later (using the anonymous ID).

    An event attributed to an unknown person. If you provide an anonymous_id with the event, you can associate the event with a person later (using the anonymous ID).

    • name
      Type: string
      required

      The name of the event. This is how you'll reference the event in campaigns or segments.

    • anonymous_id
      Type: string

      An identifier for an anonymous event, like a cookie. If set as an attribute on a person, any events bearing the same anonymous value are associated with this person. This value must be unique and is not reusable.

    • data
      Type: object

      Additional event data you can reference in Liquid or use to set customer attributes. You can include from_address and reply_to, but an event only triggers a campaign if you associate it with a person within 72 hours.

    • id
      Type: stringFormat: ulid

      A ULID we use to deduplicate events. If an event repeats a value we've already received, we ignore the duplicate. Our Python and Ruby libraries don't pass this ID.

    • timestamp
      Type: integerFormat: unix timestamp

      The unix timestamp when the event took place. If you don't provide this value, we use the date-time when we receive the event.

    • type
      Type: stringenum

      Sets the event type. If your event isn't a page or screen type event, we automatically set this property to event.

      values
      • event
      • page
      • screen
Responses
  • 200

    A successful request returns an empty object response.

  • application/json
  • 401

    Unauthorized request. Make sure that you provided the right credentials.

Request Example for post/api/v1/events
curl https://track.customer.io/api/v1/events \
  --request POST \
  --header 'Content-Type: application/json' \
  --header 'Authorization: Basic username:password' \
  --data '{
  "name": "watched_video",
  "anonymous_id": "abc123",
  "data": {
    "video": "intro-to-platform"
  }
}'
No Body