Overview: Query Builder for Google Analytics

With the Query Builder for Google Analytics, you can create Custom Google Analytics Metrics using a combination of Metrics, Dimensions, Segments, and Filters. 

Some popular use cases for the Query Builder for Google Analytics include creating content-specific Metrics, reporting on custom Goal Conversions, and accessing additional Date Ranges for Google Analytics Metrics.


How to access the Query Builder for Google Analytics

Navigate to Metrics > Query Builder to access the Query Builder. Click the green + New Custom Metric button and select your connected Google Analytics Account from the Data Source drop-down list. 

    Query Builder is available in Plus and Business Accounts. Agency Basic Accounts have access to Query Builder in the Agency Account only.  Request a trial of Query Builder by following these steps.  

How to use the Query Builder for Google Analytics 

  Custom Metric Name: Enter a name for your Custom Metric. This Custom Metric name will be available in the Designer after saving. 
  Metric: Select a Metric from your connected Google Analytics Data Source, such as Sessions, Pageviews or Pages / Session. Certain Metrics, like Goal 2 Completions, allow you to report on custom Goals set within the Google Analytics Account. 
  Dimension (Optional): The Dimensions parameter re-categorizes the returned Metric value based on common criteria. Examples of Dimensions are Default Channel Grouping, Pages, and Device Category. If no Dimension is selected, the Custom Metric will store 1 aggregated Metric value for each Date Range. 
Pro Tip: Add the word "by" in between the Metric and Dimension in order to determine an appropriate Custom Metric Name. From the Metric and Dimension examples outlined above, we could create the Custom Metrics "Sessions by Default Channel Grouping," "Pageviews by Page," or "Pages / Session by Device Category."

Most tables in Google Analytics organize Dimensions into rows and Metrics into columns. In order to replicate the Google Analytics table below in Databox, you would need to create 6 Custom Metrics: "Users by User Type," "New Users by User Type," "Sessions by User Type," "Bounce Rate by User Type," "Pages / Session by User Type," and "Avg Session Duration by User Type."


  Date Range: Select up to 8 Date Ranges that will be available for the Custom Metric. The Date Ranges selected are the only periods of time that data is synced for this Custom Metric. 
   Compare With (Optional) : Select a comparison period to measure each Date Range against, like Previous Period or Same Period Last Year. Data for the comparison period will be synced for each Date Range that is selected. 
This data can be used on a Line Chart or Bar Chart to show past performance. It is also used to calculate the percentage growth or loss of the current Date Range performance vs the comparison Date Range performance. If no Compare With parameter is selected, comparison percentages cannot be displayed for the Custom Metric. 
  Segment (Optional) A segment is a subset of your Analytics data. For example, out of your entire set of Users tracked, one Segment might be Users from a particular Country. Another Segment might be Users who purchase a particular line of products, or Users who came to your website from an Organic Source. 
Learn more about creating Segments in Google Analytics here.
  Metric Sort Order: Choose either an "Ascending" or "Descending" sort order for the returned Custom Metric values. "Descending" is the default sort order and should be selected for any Metrics where higher Metric values are desired (like "Sessions" and "Pageviews"). "Ascending" sort order should be selected for Metrics where lower Metric values are desired (like "Bounce Rate" and "Cost per Click").
Learn more about the significance of the Metric Sort Order here.
  Filter by (Optional) Filters restrict the data that gets included in the Custom Metric. All data that is returned is tested against the Filter(s). Multiple Filters can be combined using AND boolean logic. 
If the data synced from the Metric and Dimension fields meet the Filter specifications, the data is retained and included in the Custom Metric value. If the data synced from the Metric and Dimension fields don't meet the Filter specifications, the data is excluded from the Custom Metric value.
  Data Preview: After clicking Run query, a Data Preview of the Custom Metric will be displayed. Daily Metric values are displayed in this section, along with the total Metric values for the Date Range in bold at the bottom. You can view the Data Preview for different Date Ranges by clicking on the tabs at the top of the Data Preview. 
Pro Tip : If you don't know which Filters to put in place for your use case, use the Dimension + Data Preview to troubleshoot and get more insight into the data that is returned from your Google Analytics Account for each field. Learn more here.

How to create a Custom Google Analytics Metric [Example]

In this example, we'll create a Custom Metric to report on New Users tracked in the Google Analytics Account split up based on the Country where the User accessed the website. We only want to view this data for New Users that found the website through Organic Search. 

 Navigate to Metrics  > Query Builder   
 Click the green + New query button
 Select the appropriate Google Analytics Data Source
 In order to accurately explain what this Custom Metric is reporting on, we'll name the Custom Metric "New Organic Users by Country" 
 Next, we'll select Country from the Dimensions drop-down list so that the New User values returned are split up based on the Country where the site was accessed.
 From the Date Range drop-down list we'll select any Date Ranges that we want available for this Custom Metric.
 In order to get a better understanding of current performance, we'll choose Previous Period from the Compare With drop-down list.
  Organic Traffic is a standard Segment in every Google Analytics Account, so we will select this from the Segment drop-down list to focus on the Organic subset of New Users. 
 Since New Users is a Metric where higher values indicate success, we don't need to select a Metric Sort Order and can rely on the default setting, which is Descending. 
 We don't need to further Filter the data, so we will leave the Filter section blank as well. 
 Click Run query to generate a Data Preview of the Custom Metric. 
 Once we confirm that these are the results we're looking for, we'll click Save to save the Custom Metric. 

How to add a Custom Google Analytics Metric to a Databoard


 Open the selected Databoard in the Databox Designer, or create a new Databoard.
 Drag and drop a blank Datablock onto the Databoard from the Visualization Library. 
 Select the appropriate Google Analytics Data Source in the righthand Property Manager. This must be the same Google Analytics Account that was selected when creating the Custom Metric. 
 Select the  Custom tab at the top of the  Metric drop-down list. 
 Select the Custom Metric name to populate the Datablock.
Did this answer your question? Thanks for the feedback There was a problem submitting your feedback. Please try again later.

Still need help? Contact Us Contact Us