Date and Time
local_time extractor
This extractor is useful when you need to parse a local date-time and get a time-of-day (or something similar) from there to catch a seasonality: maybe visitor behavior is different on morning and in evening? Given the event:
and the following feature config:
This extractor will pull the 10:15:30+01:00
, and map it into a 0..23.99
range, so one second before midnight will be 0.99, and midday will be 0.5.
This extractor can use both a separate field or an event-level ranking.timestamp
one.
Supported parse
field values:
day_of_week
: day number in 1..7 range, where Monday is 1time_of_day
: local time in 0.0..23.99 rangeday_of_month
: day of current month in 1..31 rangemonth_of_year
: current month in 1..12 rangeyear
: absolute current year valuesecond
: current local timestamp in seconds from epoch start
item_age
Sometimes it can be useful to know how fresh is the item in the ranking? Consider the following item metadata event:
It's possible to compute how much time has passed from the created_at
field value till now, with the following config snippet:
The source
field should have any of the following types:
string
, ISO8601 date+time+timezone, example: "2021-12-03T10:15:30+01:00"number
, unixtime (number of seconds from epoch start), example1648483661
string
, unixtime as a string (so there will be no json number rounding), example:"1648483661"
you can reference the event timestamp (not the free-form field, but the native top-level event timestamp) with a
item.timestamp
Last updated