Especially for embedding, it may be necessary to construct the dashboard link/embed URL with specific parameters applied. The dashboard parameters - aggregation, timerange and custom filters are encoded in the URL in the following way.
1. Aggregation
Aggregation is the simplest, using aggregation=<value>
URL parameter, with the possible values being: second, minute, hour, day, week, month, quarter,
year
.
2. Timerange
Timerange is represented using a timerange=<value>
URL parameter, the possible values are:
From-To: <unix_timestamp>~<unix_timestamp>
Before: ~<unix_timestamp>
After: <unix_timestamp>~
Last n units: <number>_full_<unit>
Last n units (ending now): <number>_<unit>
This unit: thisfull_<unit>
This unit (ending now): this_<unit>
Previous unit: previous_<unit>
3. Custom filters
Custom filters are represented all together in a URL-encoded JSON structure:
{ <filter_name>: [<filter_value_1>, <filter_value_2>,...], <filter_name_2>: [<filter_value_1>, <filter_value_2>,...], ... }
Example code: encodeURIComponent('{"countries":["United States","Canada"],"origin_airports":["LAX"]}') "%7B%22countries%22%3A%5B%22United%20States%22%2C%22Canada%22%5D%2C%22origin_airports%22%3A%5B%22LAX%22%5D%7D"