Using Data Interpolator with Custom Metrics

When creating a custom metric, you can use Grow's Date Interpolator to keep your metric current or to select a specific time period. You can get to the interpolator by selecting custom range in the date range options in the report options of some data sources. If you don't want to use the interpolator, you can click the blue button labeled Go back to simple date selector and you can then choose a preset date range.

Most custom metrics will ask for a Since date and an Until date. You can type in specific dates in YYYY-MM-DD format (start: 2019-01-01, end: 2019-01-15), but what if you want a time period to be dynamic?


You can use strings to manipulate the time period you want to retrieve. The basic string is: {{date('YYYY-MM-DD')}}

This will always return the current date.

You can then manipulate this string to get specific time periods or to return a specific amount of days, weeks, months, or years around to the current date.

So if the current date is this: {{date('YYYY-MM-DD')}}
To get the last 7 days you would enter this: {{date('-7days','YYYY-MM-DD')}} in the From Date field and the string above in the To Date field.

If you select one of the existing date range options (e.g., "Last Week" or "60 Days Back") and then select the Custom Range option, the start and end fields will show the logic used for that date range. You can then use that as a basis to make a custom range as seen in the example below:



To get data for one of the time frames below until the current day, you would set the listed string as the From Date and {{date('YYYY-MM-DD')}} as the To Date.

From Beginning of Week

  • Start of week: {{date('start of week','YYYY-MM-DD')}}
  • This shows all of the data from the most recent Sunday up until the current day.


  • Start of last month: {{date('-1months','start of month','YYYY-MM-DD')}}
  • End of last month: {{date('start of month','-1days','YYYY-MM-DD')}}


  • Start of quarter: {{date('start of quarter','YYYY-MM-DD')}}
  • End of Last Quarter: {{date('start of quarter','-1days','YYYY-MM-DD')}}
  • Start of Last Quarter: {{date('-3months','start of quarter','YYYY-MM-DD')}}


  • Last year: {{date('-1years','YYYY-MM-DD')}}
  • Last 2 years: {{date('-2years','YYYY-MM-DD')}

End of Month

  • End of month: {{date('+1months','start of month','-1days','YYYY-MM-DD')}}

Custom Time Frames

You can also use the date interpolator to show a specific time period prior to the current date.

For example: enter {{date('-1years','YYYY-MM-DD')}} into the From Date and {{date('YYYY-MM-DD')}} into the To Date to return all data from one year ago to today's date.

You can also use the date interpolator to set a custom date range.

For example: enter {{date('-2months','YYYY-MM-DD')}} into the From Date and {{date('-1months','YYYY-MM-DD')}} into the To Date to get all of the data from last month.

When using these kinds of strings, the string entry should always be plural even if the amount is only one (i.e. 1 months or 1 days).

Adjusting For Time Zones

Grow's severs are on UTC time. You have the option to adjust the # of hours offset for your time zone.

Mountain Standard Time (MST): Created>={{date('-6hours','-30days','YYYY-MM-DD')}}

Australia: Created>={{date('+10hours','-30days','YYYY-MM-DD')}}

Date Format Specification

Not only can the Interpolator manipulate dates to always be a certain number of days in the past, it also allows you to specify the date format.

The examples so far have used 'YYYY-MM-DD' in their format specification.
By putting a dash in between the YYYY, the MM, and the DD, the date output will look exactly like that: (2016-06-28).

Sometimes data sources expect dates in different formats. For example, Google Adwords sometimes expects date formats to look like this (20160628). In order to achieve that, you can just use that style for the format specification in the interpolator:{{date('YYYYMMDD')}}. Here, there are no dashes between year, month, and date. This will set the date to show as 20160628.

Always put the date format specification at the end, after you do all of the date manipulation.

If you need to get even more technical with hours, seconds, or Unix timestamps, Grow follows the patterns found here at this link

Was this article helpful?