Skip to content
Last updated

Example: Cookies with Every Attribute

ObservePoint collects every attribute about cookies that it finds on your website during audits.

This example shows how to retrieve every cookie (and all its attributes) that ObservePoint has collected from every page on all your websites.

List of cookie attributes:

  • Final Page URL: The URL of the page that the cookie was found on
  • Cookie Name: The name of the cookie
  • Cookie Domain: The domain of the cookie
  • Cookie Value: The value of the cookie
  • Cookie Party Type: The party type of the cookie
  • Initiators Tag IDs: The IDs of the tags that initiated the cookie
  • Cookie Path: The path of the cookie
  • Cookie HTTP Only: Whether the cookie had the HttpOnly flag set
  • Cookie Secure: Whether the cookie has the Secure flag set
  • Cookie Same Site: The cookie's SameSite attribute
  • Cookie Expiration Type: The type of expiration for the cookie, timestamp or session.
  • Cookie Partition Key: The cookie's partition key.
  • Cookie Expiration Date: The date and time the cookie expires
  • Cookie Duration: The expiration duration of the cookie, in seconds
  • Cookie Size: The size of the cookie's value, in bytes
  • Cookie Total Initiator Count: The total number of initiators that set the cookie
  • Cookie JavaScript Initiator Count: The number of initiators that set the cookie via JavaScript code (using document.cookie or CookieStore.set() API)
  • Cookie Tag Initiator Count: The number of tags that ObservePoint identified which initiated the cookie
  • Cookie Changed During Page Load: Whether the cookie was changed during the page load
  • Cookie Changed During On Page Action: Whether the cookie was changed during an on-page action executed by ObservePoint
  • Cookie Changed During Pre Audit Action: Whether the cookie was changed during a pre-audit action executed by ObservePoint before the audit
  • Cookie Set Methods: The methods used to set the cookie, Server-side Http or Client-side Application

Grid API Request

POST to https://api.observepoint.com/v3/reports/grid/cookies
{
  "columns": [
    {"columnId": "FINAL_PAGE_URL"},
    {"columnId": "COOKIE_NAME"},
    {"columnId": "COOKIE_DOMAIN"},
    {"columnId": "COOKIE_VALUE"},
    {"columnId": "COOKIE_PARTY_TYPE"},
    {"columnId": "INITIATORS_TAG_IDS"},
    {"columnId": "COOKIE_PATH"},
    {"columnId": "COOKIE_HTTP_ONLY"},
    {"columnId": "COOKIE_SECURE"},
    {"columnId": "COOKIE_SAME_SITE"},
    {"columnId": "COOKIE_EXPIRATION_TYPE"},
    {"columnId": "COOKIE_PARTITION_KEY"},
    {"columnId": "COOKIE_EXPIRATION_DATE"},
    {"columnId": "COOKIE_DURATION"},
    {"columnId": "COOKIE_SIZE"},
    {"columnId": "COOKIE_TOTAL_INITIATOR_COUNT"},
    {"columnId": "COOKIE_HTTP_INITIATOR_COUNT"},
    {"columnId": "COOKIE_JS_INITIATOR_COUNT"},
    {"columnId": "COOKIE_TAG_INITIATOR_COUNT"},
    {"columnId": "COOKIE_CHANGED_DURING_PAGE_LOAD"},
    {"columnId": "COOKIE_CHANGED_DURING_ON_PAGE_ACTION"},
    {"columnId": "COOKIE_CHANGED_DURING_PRE_AUDIT_ACTION"},
    {"columnId": "COOKIE_SET_METHODS"}
  ],
  "filters": {
    "conditions": [
      // Only get the cookies from the most recent visit to any given page, to
      // avoid reporting out-of-date cookie information from old audits:
      {
        "operator": "integer_in",
        "filteredColumn": {"columnId": "IS_MOST_RECENT_PAGE_SCAN"},
        "args": [1]
      }
    ]
  },
  "sortBy": [
    {"columnIndex": 0, "sortDesc": true}
  ],
  "page": 0,
  "size": 10000
}

Example Response JSON

Grid API Response JSON
{
  "rows": [
    [
      "https://example.com/page1", // Page URL where the cookie was found
      "_lscache_vary", // Cookie Name
      "example.com", // Cookie Domain
      "f3becba3df4bb2e285362eca46b81c55", // Cookie Value
      1, // Cookie Party Type: 1 = 1st-party, 2 = 3rd-party
      [], // Initiators Tag IDs
      "/", // Cookie path
      1, // Cookie HTTP Only
      1, // Cookie Secure: 1 = Secure, 0 = Insecure
      null, // Cookie SameSite
      1, // Cookie Expiration Type: 1 = Timestamp, 2 = Session
      null, // Cookie Partition Key
      "2024-10-11T19:41:04.597+00:00", // Cookie Expiration Date
      172800000, // Cookie Expiration Time in Milliseconds
      32, // Cookie Value Size in Bytes
      1, // Cookie Total Initiator Count
      1, // Cookie HTTP Initiator Count
      0, // Cookie JavaScript Initiator Count
      0, // Cookie Tag Initiator Count
      1, // Cookie Changed During Page Load: 1 = Yes, 0 = No
      0, // Cookie Changed During On Page Action: 1 = Yes, 0 = No
      0, // Cookie Changed During Pre Audit Action: 1 = Yes, 0 = No
      [
        1 // Cookie Set Methods: 1 = Server-side Http, 2 = Client-side Application
      ]
    ],
    [
      "https://example.com/page2", // Page URL where the cookie was found
      "XSRF-TOKEN", // Cookie Name
      "example.com", // Cookie Domain
      "eyJpdiI6Iks3OVVHaVV5amJIZXJSbGNFU0gwMVE9PSIsInZhbHVlIjoiblArZUphU3lNR01MQWlrZTVUc1FLYWJpOWdLY0RjRFI0clg2OHJUN1pXUm9kOGJzbmNiWGJOb1JhSkN0dS9lSEZ1RVpYWHJVSUNZRE5YeDFPWW9lQmZRaUF1Wi9PSHEyUEhhY04xR3h0TlVHbWZUVDJ6a1kzY1pFZEZ2N0ZRNXAiLCJtYWMiOiJkMjU2NjRlM2MyNjZlZmE2ZjIxNjNhZWExOGM3NWFmZGFiZDA5YzE1OTBiMDk1ZmQyZjgxMDNiYWJjYTBhNDMzIiwidGFnIjoiIn0%3D", // Cookie Value
      1, // Cookie Party Type: 1 = 1st-party, 2 = 3rd-party
      [], // Initiators Tag IDs
      "/", // Cookie path
      0, // Cookie HTTP Only
      0, // Cookie Secure
      null, // Cookie SameSite
      1, // Cookie Expiration Type: 1 = Timestamp, 2 = Session
      null, // Cookie Partition Key
      "2024-10-10T07:06:09.267+00:00", // Cookie Expiration Date
      7200000, // Cookie Expiration Time in Milliseconds
      342, // Cookie Value Size in Bytes
      1, // Cookie Total Initiator Count
      1, // Cookie HTTP Initiator Count
      0, // Cookie JavaScript Initiator Count
      0, // Cookie Tag Initiator Count
      1, // Cookie Changed During Page Load: 1 = Yes, 0 = No
      0, // Cookie Changed During On Page Action: 1 = Yes, 0 = No
      0, // Cookie Changed During Pre Audit Action: 1 = Yes, 0 = No
      [
        1 // Cookie Set Methods: 1 = Server-side Http, 2 = Client-side Application
      ]
    ],
    [
      "https://example.com/page3", // Page URL where the cookie was found
      "ss_cvt", // Cookie Name
      "example.com", // Cookie Domain
      "1728583096891", // Cookie Value
      1, // Cookie Party Type: 1 = 1st-party, 2 = 3rd-party
      [], // Initiators Tag IDs
      "/", // Cookie path
      0, // Cookie HTTP Only
      0, // Cookie Secure
      null, // Cookie SameSite
      1, // Cookie Expiration Type: 1 = Timestamp, 2 = Session
      null, // Cookie Partition Key
      "2024-10-10T18:28:22.000+00:00", // Cookie Expiration Date
      1800000, // Cookie Expiration Time in Milliseconds
      13, // Cookie Value Size in Bytes
      1, // Cookie Total Initiator Count
      1, // Cookie HTTP Initiator Count
      1, // Cookie JavaScript Initiator Count
      0, // Cookie Tag Initiator Count
      1, // Cookie Changed During Page Load: 1 = Yes, 0 = No
      0, // Cookie Changed During On Page Action: 1 = Yes, 0 = No
      0, // Cookie Changed During Pre Audit Action: 1 = Yes, 0 = No
      [
        2 // Cookie Set Methods: 1 = Server-side Http, 2 = Client-side Application
      ]
    ],
    ... // more cookies will appear here
  ]
}