Usage
dimension: field_name {
link: {
label: "desired label name"
url: "desired_url"
icon_url : "url_of_an_image_file"
}
# Possibly more links
}
}
Hierarchylink |
Possible Field TypesDimension, MeasureAcceptsVarious parameters |
Definition
The link
parameter lets you add web links to dimensions and measures to enable users to easily navigate to related content directly from Looker. The form of a link
parameter is:
The link
parameter has several child parameters:
label
is the name of the link that you want to appear to users.url
is the URL that you want the link to go to. You can use Liquid variables to make the links dynamic, as described in the Using Liquid variables withlink
section on this page.icon_url
is a URL, accessible to the user’s browser, that contains an image file. This makes it easier for users to understand, at a glance, where the link will take them. Theicon_url
parameter is not required if you do not want an icon. If you need corporate logos, try running a Google search with the patternhttp://www.google.com/s2/favicons?domain=[company website of interest]
to find images in the.ico
format.
Example
An e-commerce company wants employees to be able to contact warehouse support directly from Looker content, such as a Look displaying pending orders from the past month. The Look contains order IDs, and the user ID of the customer associated with each order:
You can add a link to the Orders ID dimension to make this action available to the user viewing the Look:
The user will see the link among the options in the link menu, accessed by clicking the three-dot menu:
Clicking the link name will take the user to the linked content — in this case, a new tab with a blank email draft addressed to the specified email address:
The example above includes a
sql
parameter. Ifsql
is left unspecified, then Looker assumes that there is a column in the underlying table with the same name as the field.
Link behavior
When a user clicks a link, Looker will open the link either in a new browser tab or in the same tab (or iframe, for embedded queries):
- Absolute links, such as
https://example.looker.com
, will open in a new browser tab. - Relative links, such as
/dashboards/456
, will open in the same browser tab or iframe. Once the link is opened, the user can click Back in the browser to navigate back to the original query.
A user must have either the explore
or see_drill_overlay
permission to access links.
Using Liquid variables with link
The link
parameter supports Liquid variables to make content even more interactive down to the row and value level. LookML supports two kinds of Liquid usage tags: value input {{ }}
tags and conditional logic {% %}
tags.
Of the two, {{ }}
, in conjunction with the value
and _filters['view_name.field_name']
Liquid variables, is most commonly used with link
. This is because {{ }}
tags input values directly where they are placed, such as within a URL.
See the examples on this page for examples of using Liquid {{ }}
tags with the value
and _filters['view_name.field_name']
variables to make content interactive with link
.
Linking to external content
For example, suppose you had an artist_name
dimension and wanted the user to have the option of executing a Google search for that artist, right from Looker. You can use the value
Liquid variable to add that option to a dimension like the following:
The user’s experience for this dimension link would look like this:
The link opens a new browser tab to a Google search for the artist they selected. The selected artist name is inserted into the URL where {{ value }}
is placed.
This pattern can be replicated for other external websites that a user’s browser has access to, such as ticket management systems, client management systems, and other business-related tools, for ease of navigation between web applications.
Linking to content in Looker
In addition to external sites, you can use the link
parameter to direct users to other relevant Looker Explores, Looks, or dashboards for a custom drilling experience.
To start, you will need to obtain the URL of an existing Explore, Look, or dashboard that you want to link to. Then you can replace specific elements of the URL, such as filter values and names, with {{ }}
tags containing value
and _filters['view_name.field_name']
variables. The variables will input user selected values into the URL elements they replace. The basic structure of content URLs is as follows:
- Explore:
https://instance_name.looker.com/explore/YOUR_MODEL_NAME/YOUR_EXPLORE_NAME?fields=view_name.field_name1,view_name.field_name2...
- You can obtain the Explore URL for existing Explores by selecting the Expanded URL gear icon option.
- Explore filters will appear in URLs as
f[view_name.field_name]
. See the Linking to a related Explore section for an example.
- Look:
https://instance_name.looker.com/Looks/YOUR_LOOK_NUMBER
- You can obtain the URL for an existing Look by copying the browser URL from the Look page.
- Look filters will appear in URLs as
f[view_name.field_name]
. See the Passing an existing filter value to linked content section for an example.
- User-Defined Dashboard:
https://instance_name.looker.com/dashboards/YOUR_DASHBOARD_NUMBER?FILTER_NAME_1=VALUE&FILTER_NAME_2=VALUE
- You can obtain the URL for an existing dashboard by copying the browser URL from the dashboard page.
- If you are using the legacy dashboards, the URL will use
dashboards-legacy
in place ofdashboards
in the URL format.
- LookML Dashboard:
https://instance_name.looker.com/dashboards/YOUR_MODEL::YOUR_DASHBOARD
- You can obtain the URL for an existing LookML dashboard by copying the browser URL from the dashboard page.
Dashboard filters for both user-defined and LookML dashboards will appear in URLs as filter_name
, where filter_name
is the name given to the filter placed on the dashboard. See the Passing an existing filter value to linked content section for an example.
Elements of URLs, such as filter values and names, will be URL encoded with special characters, such as ?
to indicate the start of a query string, &
to separate elements, and %20
for spaces.
Once you have the URL of the content you would like to link to, you can use Liquid to insert the value of a field into any element of the URL, using the value
or _filters['view_name.field_name']
variables and {{ }}
tags. See the Using URLs and query parameters Looker Community topic for more information on the parts of a query URL.
Example: Linking to a related Explore
We have a dimension called City. We want users to be able to access another existing Explore, with city metrics and a City filter. We want the linked Explore to be filtered by the city the user selects.
To achieve this:
- Obtain the URL of the existing Explore to drill to.
- Add a
link
parameter to the City dimension:
Here, the URL has been shortened to limit=500
, which limits the Explore results to 500 rows, for clarity — you can include the rest of the URL, which typically includes URL encoding of visualization settings, as necessary.
- Insert the Liquid
{{ value }}
tag and variable where you would like to insert the value into the URL. In this case, we want to put the value where the filter element,f[users.city]=
, is located in the URL string for the Explore to be filtered by the user-selected city:
The City dimension will then display a three-dot link menu that displays the City Metrics Explore option:
When a user clicks the link, they are redirected to the City Metrics Explore, filtered by the selected city:
You can also preserve existing filter values when linking to Looker content, as discussed in the following example.
Example: Passing an existing filter value to linked content
Another Liquid variable supported by the link
parameter is _filters['view_name.field_name']
. This variable takes the existing values entered for a filter and passes them to a linked Explore, dashboard, or Look.
If you are passing the filter from a dashboard, the
_filters['view_name.field_name']
must refer to a field type filter, as set in the dashboard LookML or the legacy dashboard user interface.
In content URLs, you can see where the filter values are specified and replace them with your _filters['view_name.field_name']
variable. See the Using URLs and query parameters Looker Community topic for information on the parts of a query URL.
Here is an example of a dimension that uses the _filters['view_name.field_name']
variable in its link
parameter to pass an existing filter value for a field called users.state
:
In this example, if a user filters a query by the users.state
dimension, the linked dashboard is automatically filtered by the same states chosen in the original query. Including the Liquid filter url_encode
in this example converts URL-unsafe strings into percent-encoded strings. This ensures that filter values containing special characters, like spaces or commas, can be passed to the linked dashboard.
In the following example, the user filtered a query by the state “California.” The link opens a dashboard that is already filtered on the state of California:
This also works for passing filter values to linked Looks and Explores:
You can pass multiple filters by placing &
between them, such as in the URLs specified below:
Linking to Dashboards and Looks: Please keep in mind that a linked dashboard or Look must be configured with a filter that can accept the specified filter values. In the example above, the linked Business Pulse by State dashboard is configured with a filter on
users.state
, called State, so that the_filters['users.state']
filter value can be passed to the dashboard. If a dashboard or Look does not have a filter that can use the passed values, the link will still work, but the filter values will not be applied to the dashboard.
For information on creating dashboard filters, see the Building LookML dashboards and the Adding and editing user-defined dashboard filters documentation pages.
For additional examples of linking to Explores, Looks, and dashboards for custom drills, see the Custom drilling using HTML and link Help Center article.
Example: Using link
to customize drill visualizations
If your Looker admin has enabled the Visual Drilling Labs feature, you can customize the visualization displayed in the drill overlays of Explores, Looks, and legacy dashboards by using the link
parameter and Liquid variables. The new dashboard experience supports visual drilling using the link
parameter without the need to enable the Visual Drilling Labs feature.
Here is an example of setting a drill visualization to a scatter chart:
See the More powerful data drilling Help Center article for more examples of customizing drill visualizations.
Additional resources
- See the Custom drilling using HTML and link Help Center article for more examples of using
link
andhtml
for custom drills. - See the More powerful data drilling Help Center article for more advanced custom drilling examples.
- Refer to the Liquid variables documentation page for more examples of using
{{ value }}
in links.