v1

latestOpenAPI 3.1.02026-07-2414103.5 MB

Segment Traffic and Engagement - Desktop

Returns the traffic and engagement metrics of a predefined segment of a website on desktop devices. Includes visits, bounce rate, pages per visit, visit duration, pageviews, traffic share, unique visitors and confidence. Historical data goes back 37 months, depending on your subscription.

get/{segment_id}/traffic-and-engagement/query

Path parameters

segment_idstring required

Enter a segment ID, as defined on the Similarweb platform. Without brackets {}.

Query parameters

api_keystring required

Your Similarweb API key.

start_datestring

Start month (format: YYYY-MM)

end_datestring

End month (format: YYYY-MM)

countrystring required

Country filter, as a 2-letter ISO country code, or "world" for worldwide. To see the country filters you have access to, please refer to the Check Capabilities endpoint.

metricsstring required

List the metrics for which you would like to retrieve data for, separated by commas. Possible values: visits, share, pages-per-visit, page-views, bounce-rate , visit-duration and unique-visitors

granularitystring required

Set the granularity for the returned values. Possible values: 'daily', 'weekly' or 'monthly'.

formatstring

[optional] Format in which the reply should be returned. Possible values: 'json' (default) or 'xml'.

mtdstring

[optional] When 'true', end_date is set to the latest available days' data (month-to-date). To use, set granularity to 'daily'. Default value is 'false'. (2 hits total)

Response

200

Example response

{
  "meta": {
    "request": {
      "granularity": "Monthly",
      "segment_name": "Cool Segment",
      "segment": "1f5c345d5a-8f9f-402a-bf38-863434b785de2",
      "metrics": [
        "Visits"
      ],
      "format": "json",
      "start_date": "2023-01-01",
      "end_date": "2023-03-31",
      "country": "us"
    },
    "status": "Success",
    "last_updated": "2023-05-31",
    "device": "Desktop"
  },
  "segments": [
    {
      "date": "2023-01-01",
      "visits": 12704.1139485552,
      "bounce_rate": 0.7184542339205533,
      "pages_per_visit": 1.3487742573582953,
      "visit_duration": 200.9739948822626,
      "page_views": 17134.9818563577,
      "share": 0.004332198601683276,
      "unique_visitors": 4019.197549845116,
      "confidence": "High"
    }
  ]
}