links parameter makes it easier and more useful to add Looker links and other external links to your dimensions. The form of a
links parameter is:
links parameter has several child parameters.
labelis the name of the link that you want to appear to users.
urlis the URL that you want the link to go to. You can use Liquid variables to make the links dynamic, as described below.
icon_urlis 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. The
icon_urlparameter is not required if you do not want an icon. If you need corporate logos, try running a Google search with the pattern
http://www.google.com/s2/favicons?domain=[company website of interest]to find images in the
A common use of the
links parameter is to direct users to related Looker explores or dashboards that aren’t automatically generated by using
drill_fields. For example, this is one URL format often used to direct to a related Explore:
That dimension would produce a link menu like the one below:
When the user clicks on a link, Looker will open the link in either 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.
links parameter supports Liquid variables to make links dynamic. 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. You could create a dimension like the following:
The user’s experience for this dimension link would look like this:
Passing a Query’s Filter Values Into a Link
Another Liquid variable supported by the
links parameter is
_filters['view_name.field_name']. This variable takes the values for a filter and passes them on to a linked query, dashboard, or Look. Here is an example of a dimension that uses the
_filters variable in its
In this example, if a user filters a query on the
users.state dimension, the state(s) chosen by the user are captured and used in the link, so that the linked dashboard is automatically filtered by the same states as in the query. This is shown below, where the user has filtered a query by the state “California.” The link opens the dashboard, already filtered for California:
This also works for passing filter values to linked Looks and Explores:
Also note that you can pass multiple filters using
&, 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 “Business Pulse by State” dashboard is configured with a filter on
users.state, so that
_filters['users.state'] information in the link can be applied 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 this page for LookML dashboards and this page for user-defined dashboards.
Linking to Explores: When setting up a URL for an Explore, open the Explore in a browser and add a filter. Then, from the Explore’s gear menu, select Share and then copy the Expanded URL. In the expanded URL you can see where the filter values are specified and replace them with your
_filters variable. See this article for information on the parts of a query URL.