API Reference

Analytics (API)

Read your analytics through the Pxl API. Get insights from you analytics through the following API requests.

Related guide: Analytics.

This feature is available on the Monthly and Annual plans.


The insight object

recent: number

Example: 100

The number of page views that occured within the last 30 minutes.

total: number

Example: 500

The total number of page views that occured within the specified period.

unique: number

Example: 400

The number of unique page views that occured within the specified period.

grouped: object

An array of objects containing the total page views and unique page views for each consecutive day (or hour) within the specified period.

properties: object

An object containing the total page views and unique page views of each distinct property value, grouped by property category (city, country, device, browser) within the specified period.

Each category returns its 50 busiest values by default. Use limit to return more, dimension to request a single category, and count to find out how many values a category actually has.

count: object

Example: { "link": 2196 }

The total number of rows in each returned category, ignoring limit and skip. Only present when dimension, limit or skip is supplied.

List insight

To return all insight associated with your organisation, you will make a GET request.

GET https://api.pxl.to/api/v1/insight

Parameters

datefrom: _string

Example: 2024-12-01

The start date of the range for which data will be returned, formatted as YYYY-MM-DD. Both ends of the range are inclusive. Defaults to six days before the current date, which with the default date_to is a seven-day window.

Analytics are retained for 90 days. A date_from earlier than that is moved up to the earliest retained day rather than refused, so a request that starts before the window and ends inside it returns the days that exist.

A range that ends before the window answers 422 instead: there are no days to return, and a zeroed result would be indistinguishable from a period with no traffic.

dateto: _string

Example: 2024-12-31

The end date of the range for which data will be returned, formatted as YYYY-MM-DD. Defaults as the current date.

timezone: string

Example: Europe/Vienna

The timezone for which any returned data will be offset. Defaults to UTC.

link: string

Example: pxl.to/mylink

The specific link for which analytics data will be returned.

domain: string

Example: pxl.to

The specific domain for which analytics data will be returned.

device: string

Example: desktop

The device type for which analytics data will be returned. Values are lowercase and the match is case-sensitive, so Desktop returns nothing.

desktop and mobile account for almost all traffic and tablet for most of the rest, but the value is whatever the visitor's user agent reports, so smarttv, console, wearable and embedded also occur. Treat the list as open rather than as an enumeration.

browser: string

Example: Chrome

The specific browser for which analytics data will be returned.

OS: string

Example: Windows

The specific OS for which analytics data will be returned.

country: string

Example: US

The specific country for which analytics data will be returned, formatted as an ISO 3166 2-digit code.

city: string

Example: Washington

The specific city for which analytics data will be returned.

medium: string

Example: Click

The specific medium for which analytics data will be returned.

source: string

Example: footer

The specific source for which analytics data will be returned.

dimension: string

Example: link

Returns a single category in properties instead of all nine. One of source, browser, link, country, city, device, domain, medium, OS.

limit: number

Example: 1000

The number of rows to return per category, with a minimum value of 1 and a maximum value of 1000. Defaults to 50.

skip: number

Example: 50

The number of rows to skip within each category, with a minimum value of 0. There is no practical upper limit, so every row of a category can be reached by paging.

Categories return only their 50 busiest rows unless you ask for more

Without limit, each category in properties returns at most 50 rows. For a large workspace that is a small fraction of the data — the link category is capped at 50 however many links the workspace has, and the rest are simply absent, with nothing in the response to indicate it.

Pass limit to raise the cap and read count to see how much there is. Passing dimension as well is also considerably faster, because the other eight categories are not computed.

Returns

Returns an insight object representing the analytics performance of every link within your organisation.

When any of dimension, limit or skip is supplied, the response also carries a top-level count object giving the total number of rows in each returned category, ignoring limit and skip. Without it a short page is indistinguishable from the last page.

To read a whole category, set dimension and request pages of up to 1000 rows, increasing skip by limit each time, until skip reaches that category's count. Rows are ordered by hits descending and are broken by a stable tiebreaker, so rows with equal hits cannot swap places between one page and the next.

Each page is a separate query, so a window whose date_to is today is still filling while you page through it: a link that gains hits between two requests can move, and be returned twice or missed. For a walk that has to be exact, set date_to to a past date, which freezes the data and, as a bonus, is cached for far longer.

A page requested entirely beyond the end of a category returns an empty array for it, and that category is then omitted from count.

Sending none of dimension, limit or skip returns exactly what this endpoint has always returned, with no count object.

Request

An example CURL request:

# Any range whose end falls inside the last 90 days; an older date_to answers 422,
# and so does a date_from that is after date_to.
curl -X GET --compressed "https://api.pxl.to/api/v1/insight?timezone=Europe/London&country=US&date_from=2026-09-10&date_to=2026-09-16" \
-H "Accept-Encoding: gzip" \
-H "Authorization: Bearer <YOUR_ACCESS_TOKEN>" \

Response

An example JSON response:

{
  "data": {
    "unique": 91,
    "total": 108,
    "recent": 4,
    "grouped": [
      {
        "t": "2026-09-10",
        "visits": 7,
        "hits": 8
      },
      {
        "t": "2026-09-11",
        "visits": 11,
        "hits": 12
      },
      {
        "t": "2026-09-12",
        "visits": 10,
        "hits": 11
      },
      {
        "t": "2026-09-13",
        "visits": 11,
        "hits": 12
      },
      {
        "t": "2026-09-14",
        "visits": 15,
        "hits": 16
      },
      {
        "t": "2026-09-15",
        "visits": 14,
        "hits": 16
      },
      {
        "t": "2026-09-16",
        "visits": 23,
        "hits": 33
      }
    ],
    "properties": {
      "source": [
        {
          "type": "banner",
          "visits": 52,
          "hits": 52
        },
        {
          "type": "app",
          "visits": 18,
          "hits": 23
        }
      ],
      "browser": [
        {
          "type": "Chrome",
          "visits": 74,
          "hits": 89
        },
        {
          "type": "Edge",
          "visits": 4,
          "hits": 6
        },
        {
          "type": "Firefox",
          "visits": 3,
          "hits": 3
        }
      ],
      "link": [
        {
          "type": "pxl.to/example",
          "visits": 52,
          "hits": 52
        },
        {
          "type": "pxl.to/example/2",
          "visits": 13,
          "hits": 15
        }
      ],
      "country": [
        {
          "type": "US",
          "visits": 91,
          "hits": 108
        }
      ],
      "city": [
        {
          "type": "Charlotte",
          "visits": 27,
          "hits": 33
        },
        {
          "type": "Boardman",
          "visits": 6,
          "hits": 6
        },
        {
          "type": "Los Angeles",
          "visits": 5,
          "hits": 5
        },
        {
          "type": "San Jose",
          "visits": 3,
          "hits": 4
        },
        {
          "type": "Dallas",
          "visits": 3,
          "hits": 3
        }
      ],
      "device": [
        {
          "type": "desktop",
          "visits": 87,
          "hits": 103
        },
        {
          "type": "mobile",
          "visits": 3,
          "hits": 4
        },
        {
          "type": "tablet",
          "visits": 1,
          "hits": 1
        }
      ],
      "domain": [
        {
          "type": "pxl.to",
          "visits": 78,
          "hits": 93
        }
      ],
      "medium": [
        {
          "type": "Click",
          "visits": 91,
          "hits": 108
        }
      ],
      "OS": [
        {
          "type": "Windows",
          "visits": 39,
          "hits": 47
        },
        {
          "type": "Mac OS",
          "visits": 19,
          "hits": 23
        },
        {
          "type": "Linux",
          "visits": 17,
          "hits": 21
        }
      ]
    }
  }
}

Paged request

Reading the link category one page at a time. count.link is the number of links with traffic in the period, so paging continues until skip reaches it:

curl -X GET --compressed "https://api.pxl.to/api/v1/insight?dimension=link&limit=1000&skip=0&date_from=2026-09-10&date_to=2026-09-16" \
-H "Accept-Encoding: gzip" \
-H "Authorization: Bearer <YOUR_ACCESS_TOKEN>" \

An example JSON response, abbreviated:

{
  "data": {
    "unique": 91,
    "total": 108,
    "recent": 4,
    "grouped": [
      {
        "t": "2026-09-10",
        "visits": 7,
        "hits": 8
      }
    ],
    "properties": {
      "link": [
        {
          "type": "pxl.to/mylink",
          "visits": 52,
          "hits": 52
        },
        {
          "type": "pxl.to/otherlink",
          "visits": 18,
          "hits": 23
        }
      ]
    }
  },
  "count": {
    "link": 2196
  }
}

grouped, unique, total and recent are never paged; they always describe the whole period.

Previous
Short Links (Legacy)