Overview: HubSpot Marketing Contacts Query Builder

In this article, we'll give an overview of the HubSpot Marketing Contacts Query Builder and work through an example based on a specific use case.

Please note that no daily data is available for those Metrics. Only total values for selected Date Range.


1. Custom Query overview

  Custom Query Name (required) : In this field, you can create a custom name for your query. This name will then be the metric title that you'll select in the Designer tool after saving the query.
  Report (required): Select one of the three reports - depending on what data you would like to pull from HubSpot. This article is outlining the capabilities of the Contacts report. 
  Metric (required): Select a metric from your connected HubSpot account, such as "Became a Lead," Became a Customer", etc. This metric can be used in conjunction with a dimension in the next step.
  Dimensions (optional) The dimensions parameter breaks down metrics by common criteria, such as  Original source or Owner. The metric output is then recategorized based on the selected dimension value.

If a query has no dimension selected as a parameter, the returned metric will provide aggregate values, such as the overall number of contacts that Became a Lead in the given date.
  Date range (required) To display your data in the most optimal way, you will need to choose time intervals. Click on the "Date range" field and select the intervals (up to 8) that you want as options when you pull this into the databoard.
 Compare With (optional) : Select a date range to compare your previously selected interval to. This date range will be used for the "previous line" on line and bar charts, and for calculating percent change. Options are: None, Previous period and Same period last year.

2. Results

The "Data Preview" section allows you to see all values that are being pulled in based on the query you have created. At the bottom, you can find the total values  bolded. To see data previews for different date ranges, click on the various tabs at the top of the preview.

3. Example

In this example we want to show how many contacts became a lead last month, and split the results by the different sources they came from. Here's what we're replicating from HubSpot's UI. 

1. We'll name our custom query "Became a Lead by Source". 

2. For the metric, select "Became a Lead." 

3. The dimension for this example is "Original Source." 

4. In the date range field, choose which intervals you want to display the data for. Since our goal is to show the data for "Last month," we need to make sure we select that time interval. Keep in mind that you can choose more than one date range! 

5. We also want to compare the data to the previous period, so we will choose "Compare with: Previous period".

Our query is all set up! The next step is to  run the query and use the Data Preview section to view the data that is being pulled in, filtered by source. 

If everything looks good, save the custom query. From the Designer, you can now select the new custom metric from the "Custom" tab of the metric drop down list. 

NOTE: This custom query will only be available if you have the correct data source selected. 

Still need help? Contact Us Contact Us