v1.0.0
OpenAPI 3.1.0

Track pageviews

US region

Client Libraries

Track pageviews

Sends a page view event. If you use our JavaScript source, it automatically records page events whenever it loads (every page). If you use a single-page app, you'll need to call the page method people change routes.

The request consists of the page name and additional properties about the page.

If you use our JavaScript library, the page name and URL are automatically gathered and passed as event properties.

When you use our libraries, you'll typically only provide a user ID/anonymous ID and the name of the page. The libraries fill in the rest of the payload automatically.

Headers
  • X-Strict-Mode
    enum
    const:  
    1

    When set to 1, enables strict validation that returns proper HTTP error codes (400/401) for validation failures. When not set or set to any other value, the API operates in permissive mode, logging errors but returning HTTP 200. Learn more

    values
    • 1
Body
application/json
      • userId
        Type: string
        required

        The unique identifier for a person. This value should be unique across systems, so you recognize the same person in your sources and destinations.

      • context
        Type: object · Non-mobile

        A dictionary of context about a source call/event, like the user’s IP address or locale. Context is automatically collected by our source libraries.

      • integrations
        Type: object

        Contains a list of booleans indicating the integrations that are enabled (true) or disabled (false). By default, all integrations are enabled (returning an empty object). Set "All": false to reverse this behavior.

      • messageId
        Type: string

        A unique identifier for a Data Pipelines call, ensuring that each individual event is unique. This is set by Customer.io

      • name
        Type: string

        The name of the page.

      • originalTimestamp
        Type: stringFormat: date-time

        In general, you can use timestamp rather than this field if you want to back-date events. This is the timestamp on the client device you invoke a call or the timestamp value you manually passed in a server-side library call.

      • properties
        Type: object

        Additional page properties. Analytics.js automatically collects url, title, referrer, path, and search properties. But, if you use our other sources or you write your own integration, you should consider sending these properties yourself. Destination actions that take page events often rely on the url and title properties.

      • sentAt
        Type: stringFormat: date-time

        The ISO-8601 timestamp when a library sends an event to Data Pipelines.

      • timestamp
        Type: stringFormat: date-time

        The ISO-8601 timestamp when the event originally took place. This is mostly useful when you backfill past events. If you're not backfilling data, you can leave this field empty and we'll use the current time or server time.

Responses
  • 200

    A successful request returns an empty object response.

Request Example for post/page
curl https://cdp.customer.io/v1/page \
  --request POST \
  --header 'X-Strict-Mode: 1' \
  --header 'Content-Type: application/json' \
  --header 'Authorization: Basic username:password' \
  --data '{
  "anonymousId": "507f191e810c19729de860ea",
  "channel": "browser",
  "context": {
    "ip": "8.8.8.8",
    "userAgent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_9_5) AppleWebKit/537.36 (KHTML like Gecko) Chrome/40.0.2214.115 Safari/537.36"
  },
  "integrations": {
    "All": true,
    "Mixpanel": false,
    "Salesforce": false
  },
  "messageId": "022bb90c-bbac-11e4-8dfc-aa07a5b093db",
  "name": "Home",
  "properties": {
    "title": "Welcome | ACME, Inc.",
    "url": "https://www.example.com"
  },
  "receivedAt": "2015-02-23T22:28:55.387Z",
  "sentAt": "2015-02-23T22:28:55.111Z",
  "timestamp": "2015-02-23T22:28:55.111Z",
  "type": "page",
  "userId": "97980cfea0067",
  "version": 1.1
}'
No Body