Custom metrics: Resources and tips

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:

Google Analytics

Resources

Query tips

  • Data view: All views that include "Metrics" or "Dimensions" as optional columns.

Tip: When applying filters for the columns "Dimensions" or "Metrics", if you apply multiple filters, the values will be returned as a comma separated list in a single column. You'll need to add a new column for each member and write a formula using SUBSTRING and INDEXOF to isolate the individual entries.

To explain this further, we'll use an example that selects Traffic as the data view and Date, Dimensions, and Sessions as the columns. We'll apply filters to the Dimensions column to see data by continent and by age group. (See below.)

After previewing your data and clicking Save and continue you enter the modeller. Here you will add a new column for Continent and a new column for Age. For each new column, you'll write a formula using SUBSTRING and INDEXOF.

  1. In the modeller, add a new column for Age, by clicking the + sign.
  2. In the formula bar, with the new column selected, enter the following:

SUBSTRING(&Dimensions,INDEXOF(&Dimensions,",")+1)

  1. By entering the formula above, you refer to the "Dimensions" column and isolate the age related information by single entry. Next, select the column header row and change its name to Age. (See below.)

  1. Add a new column for Continent by following the same method as above but altering the formula slightly, as shown below:

SUBSTRING(&Dimensions,0,INDEXOF(&Dimensions,","))

Google Ads

Resources

HubSpot

Resources

Query tips

  • Data view: Engagements

Tip: Under Columns, when applying a date filter, select "UpdatedAt" (not "CreatedAt"). 

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.

LinkedIn Pages

Resources

LinkedIn Ads

Resources

Instagram Business

Resources

Twitter

Resources

Query tips

  • Data View: Users

Tip: To get data for a specific user ID, under Data view filters, select +Add filters (optional) > User_ID and click Apply.  You must enter a specific account ID as the filter value, otherwise the data view uses the default setting and returns data for Twitter's account.

Twitter Ads

Resources

QuickBooks

Resources

Xero

Resources

Mailchimp

Resources

Stripe

Resources

Have more questions? Submit a request