Skip to main content

Documentation Index

Fetch the complete documentation index at: https://api.globalwebindex.com/docs/llms.txt

Use this file to discover all available pages before exploring further.

On this page

Creating a Crosstab with Datapoints

Crosstabs let you dig deeper into your data by comparing variables across rows and columns; this makes it a great tool for analysing audience overlap. You can use these to compare how one set of variables relates to  another, for example “Streaming frequency by Age” or “Brand awareness by Income group”. In the Platform API, a crosstab is created by referencing the required question datapoints directly in the request payload. For more information on how crosstabs work on our platform, you can find it on our help center article. For example, the crosstab below shows how personal interests vary by age group.
Image
Image from the GWI platform showcasing a crosstab.

How it works

  1. Identify the questions and data points you want to use for:
    • Rows (primary breakdown)
    • Columns (secondary breakdown)
  2. Include those datapoint identifiers in your crosstab creation request.
  3. Once the crosstab is created, use the response or results endpoint to retrieve the calculated data.
The API returns structured results representing the intersection between each row and column datapoint, including calculated metrics (e.g., percentages, base sizes). You can use the cURL below to replicate the example and adapt it to your use case.
curl -X POST "https://api.globalwebindex.com/v2/saved/crosstabs" \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -d @xb_datapoints.json

Creating a Crosstab with Different Suffixes

Some questions include suffixes, which represent variations of the same measure (for example, different timeframes such as daily, weekly, or monthly). To compare these separately, you can create a crosstab where each suffix is defined as an individual row or column selection, rather than combining them into a single input. This is used when comparing the same measure across multiple suffixes, for example “Daily vs Weekly vs Monthly usage”. For example, the crosstab below shows social media browsing frequency by age group.
Image
Image from the GWI platform showcasing an applied audience as a base to a crosstab.

How it works

  1. Identify the question and the suffixes you want to compare.
  2. Build your crosstab request so each suffix is represented as a separate selection (e.g., separate row datapoints/variables).
  3. Query the results to retrieve each suffix cut independently in the output.
This ensures each suffix is calculated and returned as its own line/item in the crosstab results, rather than being merged into a single dimension. You can use the cURL below to replicate the example and adapt it to your use case.
curl -X POST "https://api.globalwebindex.com/v2/saved/crosstabs" \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -d @xb_suffixes.json
{
  "name": "API example crosstab (datapoints)",
  "bases": [
    {
      "id": "base_all",
      "name": "All Internet Users",
      "expression": null
    }
  ],
  "country_codes": [
    "s2_1"
  ],
  "wave_codes": [
    "q1_2024"
  ],
  "rows": [
    {
      "id": "row_1",
      "name": "Boomers",
      "expression": {
        "question": "q3new",
        "datapoints": [
          "q3new_1"
        ]
      }
    },
    {
      "id": "row_2",
      "name": "Millennials",
      "expression": {
        "question": "q3new",
        "datapoints": [
          "q3new_3"
        ]
      }
    }
  ],
  "columns": [
    {
      "id": "col_1",
      "name": "Facebook Daily+",
      "expression": {
        "question": "q42011a",
        "datapoints": [
          "q42011a_3"
        ],
        "suffixes": [
          1,
          2
        ]
      }
    },
    {
      "id": "col_2",
      "name": "Instagram Daily+",
      "expression": {
        "question": "q42011a",
        "datapoints": [
          "q42011a_25"
        ],
        "suffixes": [
          1,
          2
        ]
      }
    }
  ]
}