Overview: HubSpot Marketing Blog Query Builder

In this article, we will create a Custom Metric using the HubSpot Marketing Blog Query Builder in order to highlight key functionality of the tool. For our example, we will create a new metric that returns the Bounce Rate for each of our active HubSpot Blog Posts written by Tory Sher. 


  1. Basic Options
  2. Advanced Options
  3. Data Preview
  4. Transformations
  5. Considerations

1. Basic Options

    Custom Metric Name (required): Create a name for your Custom Metric in this field. You will find this name/title as a metric option in the Designer after saving the query.
We chose "Bounce Rate by Landing Page" for our query name.
    Metric (required): Select a Landing Page metric from your connected HubSpot Data Source, such as Submissions, Avg Time on Page, Entrances, Exit Rate, CTA Views, etc. 

We chose "Bounce Rate" as our Metric selection.

    Dimension (required): The  dimension parameter breaks down the metric by a common criteria. For this Query Builder, the only Dimension option is "Blog Post." By selecting this option, the metric will be recategorized based on the Blog Posts the activities were tracked on.
    Date Range (required): To display your data the way you like, you will need to select the Date Ranges you want as options for this custom metric. You can select up to 8 Date Ranges for each custom metric. 
   Compare With (optional): Select a Date Range to compare your previously selected interval to. This date range will be used for "previous line" on Line and Bar Charts, and for calculating the percentage change. Options are:  None,   Previous period and   Same period last year.

2. Advanced Options

In our example, we set Filters in order to retrieve data only for "active Blog Posts." We are identifying "active Blog Posts" as those that have Pageviews tracked for the specified Date Range. 
   Filter by (optional): You can filter results by either Metric or Dimension Values. Filters can be combined using AND / OR boolean logic. Filtered queries restrict the rows that do (or do not) get included in the result. Each piece of data returned from this query is tested against the filter. If the filter matches, the row is retained. If it doesn't match, the row is dropped.
For this Query Builder, you have the following Filter Dimensions available: 
  • Blog Post 
  • Campaign
  • Author

All Metric options from section B are available as Filters.

Filter Operators

When everything mentioned above is set, click Run query to show the Data Preview.

3. Data Preview

In the Data Preview, you will see the total values returned for the specified Date Range. All results are pushed to the end date of the requested Date Range. You can click on the Date Range tabs to view the Data Preview for additional Date Ranges.

If you want to sort values by date/time just click on the arrow next to "Date"

When your custom metric is ready, click  Save query. This creates a custom metric under your HubSpot Marketing Data Source, with the metric name you specified in section A (i.e., Bounce Rate by Blog Post (Tory Sher)).

By default, the custom metric will be added within the Data Source that the data is pulled from. It is possible to change the Target Data Source by clicking on Target data source hyperlink in the top right of the Query Builder. Unless this is necessary for a specific use case, we do not recommend changing the Target Data Source. 

4. Considerations

  1. If there is no data returned for the specified Date Range(s), no data will be displayed in the Data Preview. 
  2. Data is only available for published Blog Posts.
  3. Metric Clarification: "Average Time on Page" is the average amount of time a visitor stays on a particular page. This is calculated by the following equation: Total Time on Page / Pageviews on Page.
  4. Since daily data is not available for these metrics, you will want to view your custom Blog Post metrics on a Visualization Type that does not necessitate granularity options. Line Charts and Bar Charts will not be good Visualization Types for this data, but Tables, Pie Charts, and Number Blocks will be.
  5. When using Filters to create custom metrics, data will only be returned for Blog Posts published within the last 2 years. 

Still need help? Contact Us Contact Us