There's a new version of the HubSpot API

We're also working on a new documentation website, you're invited to check it out and give us your feedback.

Get data for HubSpot hosted content

Last updated May 15, 2023

GET /analytics/v2/reports/:content_type/:time_period

Method Details

HTTP Methods:

GET

Response Format:

json

Requires Authentication?

Yes

Rate Limited?

Yes

Headers

User-Agent

Products:

Marketing

Required Scope:

business-intelligence

Get analytics data for your HubSpot hosted content. This would include your website and landing pages, as well as any blog pages hosted on HubSpot.

This endpoint is designed around how report data would be shown in the sources and page performance reports. For more details about how the sources report works, please see the article linked here. For more details about the page performance report, please see the article linked here.

For more details about how sessions are categorized, please see the article linked here.

In addition to getting analytics details for pages, sources data can also be pulled for pages or for blogs:
For pages:
GET analytics/v2/reports/:content_type/:page_id/sources/:time_period

For blogs:
GET analytics/v2/reports/:content_type/content-group/:blog_id/sources/:time_period

Note: Access to the data from this endpoint will depend on the subscription of the HubSpot account. Please see the overview page for more details.

Required Parameters How to use Description
OAuth access token or private app access token Authorization: Bearer {token} header Used to authenticate the request. Please see this page for more details about authentication.
Content Type /:content_type
Used in the request URL

The type of content that you want to get data for. Must be one of:

  • landing-pages - Pull data for landing pages. 
  • standard-pages - Pull data for website pages. 
  • blog-posts - Pull data for individual blog posts. 
  • listing-pages - Pull data for blog listing pages.
  • knowledge-articles - Pull data for knowledge base articles.
Page ID /:page_id/sources
Used in the request URL.

A page ID can be included the URL to get sources data for a specific page. See the examples for details.

Blog ID /content-group/:blog_id/sources/
Used in the request URL.

A blog ID can be specified to get data for all content related to a specific blog. The content_type must be blog-posts or listing-pages, see the examples for details.

Time period /:time_period
Used in the request URL

The time period used to group the data. Must be one of:

  • total - Data is rolled up to totals covering the specified time.
  • daily - Grouped by day
  • weekly - Grouped by week
  • monthly - Grouped by month
  • summarize/daily - Grouped by day, data is rolled up across all breakdowns 
  • summarize/weeklyGrouped by week, data is rolled up across all breakdowns 
  • summarize/monthlyGrouped by month, data is rolled up across all breakdowns

NOTE: When using daily, weekly, or monthly for the time_period, you must include at least one filter (&f= parameter). See below for details.

Start date 

&start=YYYYMMDD
Used in the request URL.

The start date for the data you want. Must be included as ISO 8601 format, YYYYMMDD. Note: The date is inclusive, and will be treated as being in the time zone of the portal.
End date

&end=YYYYMMDD
Used in the request URL.

The end date for the data you want. Must be included as ISO 8601 format, YYYYMMDD. Note: The date is inclusive, and will be treated as being in the time zone of the portal.

Optional Parameters How to use Description
First drilldown &d1=
Used in the request URL
Used to drilldown into the data. This parameter is designed to reflect the functionality of the HubSpot sources reports. For example, when breaking down by sources, d1 could be organic to drill down into organic traffic data.
Note: This parameter can only be used when pulling sources data.
Second drilldown &d2=
Used in the request URL
Used to further drill down into the data. Similar to d1, this reflects the functionality of the sources report. For example, if you have d1=organic, d2=hubspot would drill down into data for organic search traffic for the keyword `hubspot`.
Note: This parameter can only be used when pulling sources data.
Filter &f=
Used in the request URL.
May be included multiple times.
Filter the returned data to include only the specified breakdown. This parameter can be included multiple times to filter for multiple breakdowns. For example, when breaking down by sources and using d1=organic to drill down into organic search traffic, you can get the data for the specific keywords `hubspot` and `marketing` using f=hubspot&f=marketing.

NOTE: You must include at least 1 filter when the :time_period is monthly, weekly, or daily.
Exclude &e=
Used in the request URL.
May be included multiple times.
Exclude data for the specified breakdown. This parameter can be included multiple times to exclude multiple breakdowns.For example, when breaking down by sources and using d1=referrals to drill down into referral traffic, you can exclude data for referral traffic from 'www.hubspot.com' by using e=www.hubspot.com.
Analytics View ID &filterId=
Used in the request URL
The ID of an Analytics view. If included, the returned data will only include data that matches the view. See this page for details on getting the IDs for the views.
Sort by &sort=
Used in the request URL.
If included, the results are sorted by the specified field.
Sort direction &sortDir=
Used in the request URL.
If a &sort= value is included in the request, this parameter will control the direction of sorted results. Must be one of ASC (ascending) or DESC (descending). Defaults to DESC if not included.
Limit &limit=
Used in the request URL
Used to limit the number of results per request. If included, the response will include an offset value that can be used to get the next page or results. Defaults to 350 if not included.

NOTE: This parameter will be ignored if the :time_period is monthly, weekly, or daily.
Offset &offset=
Used in the request URL

Used to get the next page of results if there are more results than the number specified in the limit parameter (or 350 if limit is not included). Each response will include an offset field, and you can use the response value in the offset parameter in the next request to get the next set of results.