Creating custom metrics using data sources: Resources and tips

 

Our recent redesign simplifies the data transfer experience by combining raw and modelled data sources into a single object - data feeds.
If you see Data Feeds in the left navigation sidebar, go to this article instead.
The data feed feature is being released gradually. If you don't see data feeds in your account yet - no worries - they’re coming soon!

 

Building custom metrics or modelled data sources and looking for help? This article includes links to descriptive articles for several key services as well as tips on retrieving (querying) data.

Each service's API is unique. When you select a data view and columns and apply filters, you're specifying the data you want to retrieve (query) from a service. Because each service's API is unique, it may be difficult to understand how to effectively narrow down the data you're looking for. For example, it may be unclear that a particular data view includes required filters or in what format the operators and values need to be entered. You might notice some services here don't include tips. We'll keep updating this article and adding more tips as we investigate and resolve the intricacies of each service's API.

Query only the data you need. By filtering to pinpoint only the data you need, you optimize the volume of data being queried. This not only makes your data easier to understand and handle, it often makes the query run faster. Learn more about filtering for custom metrics.

This article includes links to resources and tips for requesting and filtering data for the following services:

Airtable

Resources

Facebook

Resources

Query tips

  • Data view: SimpleInsights

Tip: Under Data view filters > InsightName, you'll see a long list of items. The following insights are not displayed in the list but they are available for selection: "page_daily_follows", "page_daily_follows_unique",  "page_daily_unfollows", "page_daily_unfollows_unique" , and page_follows". 

Facebook Ads

Resources

Query tips

  • Data Views: AdInsights and AdInsightsActions

Tip: Under Columns > DateEnd, when applying a filter, the "On or before" operator does not return results. The "Is", "Before", and other operators work as expected.

Google Ads

Resources

Query tips

  • Data view: All views that include a date column, when you want to retrieve data for a date range.

Tip: By default, the Google Ads API returns a single day of data. If you want to retrieve a range of data, under Columns, select Date and add the following filters: Add "On or after" as the first operator (and select the beginning of the date range). Then, add "On or before" as the second operator (and select the end of the date range).

Note that there are some exceptions, for example, "ClickView", which must be filtered to limit results to one day.

  • Data view: All views that include a date column, when you want to retrieve data for a single day or when results are limited to a single day of data, for example, when selecting “ClickView”.

Tip: Under Columns, select Date and apply a filter limiting the data returned to a single day. When applying the filter, you must use the “Is” operator.

Google Analytics 4

Resources

Query tip

  • Data view: Engagement

Tip: To include a custom dimension created for your events in a data feed, in the query builder select Engagement as the data view and, under Columns, select EventName (filtered by the event name(s) you want to include in the data feed) and Dimensions, filtered to include the name of the custom dimension (in the example below it’s “customEvent:product”).

See the example below, where we also selected Date, EventCount, and TotalUsers as columns for the data feed.

HubSpot

Resources

Query tips

  • To narrow down the data being requested and speed up the retrieval process, when applying filters, you should select properties that are supported by HubSpot’s Search API. For example, with ”Contacts” chosen as the data view, when selecting columns, choose “Create Date” or “Last Modified Date” (supported by the Search API) instead of “Created At” (not supported). All of these column selections will return data but “CreateDate” and “Modified Date” will return it much faster! You’ll find all the information you need in the HubSpot API Search docs. (See below for an example.)

Best practices for naming custom fields

  • It’s possible for custom and default fields in HubSpot to use the same label name. When this happens, a number is automatically added to the end of the custom field name, for example: “Role” becomes “Role2”. As a result, the custom field stops returning data. To prevent this auto-renaming, when creating custom fields, we recommend prefacing each name with a unique identifier, for example, use “kf_Role” instead of “Role”.

Instagram Business

Resources

LinkedIn Ads

Resources

LinkedIn Pages

Resources

Query tips

  • Data view: CompanyUpdateStatistics

Tip: Under Columns > TimeRangeEnd and Columns > TimeRangeStart, when applying filters to specify a date range for your query, you must use the "On or before" operator for TimeRangeEnd and the "On or after" operator for TimeRangeStart. You can optionally set the "TimeGranularity" query filter to "DAY" or "MONTH" to control the resolution of the data returned. 

Note: If you don't specify a date range for your query, it will use the default (lifetime statistics).

  • Data view: CompanyPageStatistics

Tip: Under Columns > ReportTimeRangeEnd and Columns > ReportTimeRangeStart, when applying filters to specify a date range for your query, you must use the "Is" or "On or before" operators for ReportTimeRangeEnd and the "Is" or "On or after" operators for ReportTimeRangeStart. You can optionally set the "TimeGranularity" query filter to "DAY" or "MONTH" to control the resolution of the data returned.

Note: If you don't specify a date range for your query, it will use the default (lifetime statistics).

Mailchimp

Resources

QuickBooks

Resources

Salesforce

Resources

Query tips

Shopify

Resources

Smartsheet

Resources

Stripe

Resources

Query tips

  • Data View: Subscriptions

Tip: Under Columns, you cannot apply date filtering for CurrentPeriodStart or Start. However, you can apply date filtering for CreatedAt.

X Ads (Twitter Ads)

Resources

Xero

Resources

YouTube

Resources

Query tips

  • Data view: TimeBasedReports and TopVideos

Tip: To get data for a specific playlist using either of these data views, under Data view filters:

  1. Click +Add filters (optional), select the checkboxes beside “IsCurated” and “Playlist”, and click Apply. Click the Click to add filter box for each one. For “Is Curated”, set Equals as the operator and true as the value. For “Playlist”, set Match All and Equals as the operators and enter your playlist Id as the value.
  2. Under Columns, select one or more of “AverageTimeInPlaylist”, “AverageViewDuration”, “EstimatedMinutesWatched”, “PlaylistStarts”, “Views”, and “ViewsPerPlaylistStart”.

Note: You must also select “Day” as a column for TimeBased Reports.

Zendesk

Resources

Query tips

  • Data views: Tickets and TicketMetrics

Tip: When applying filters to specify a date range for your query (for example, “CreatedAt”) you must select the “After” or “On or after'' operators (along with the “Before” or “On or before” operators to further constrain the query to a specific date range). The “Is” operator for a single date is not supported and will not return data. For example, to get today’s data, try “On or after” and “Today”, instead of “Is” and “Today”.

  • Data views: Any data view that can potentially retrieve a very large amount of data and to which you’ve added complex filter conditions. This example describes selecting the “Users” data view from Zendesk and applying the following filters to the “Role” column: “Role” = “agent” and “Role” = “admin”. Because the filter condition applies to two values (agent and admin) PowerMetrics needs to retrieve all of the users from your account and filter the results. Since Zendesk accounts typically include a large number of users this can result in a long running query that times out. By simplifying the filter condition to use only one value, such as "Role" = "agent" only, the query can be executed directly by Zendesk and returning results much quicker.

Tip: To resolve this issue, split your data by creating two separate data sources, in this case, create one data source for users with the agent role and one for users with the admin role. Then merge the two data sources into one that you can use for your metrics. Learn how to merge data sources in the modeller.

Zuora

Resources

Have more questions? Submit a request