home User Guide Getting Started Help Center Documentation Community Training Certification
menu
close
settings
Looker keyboard_arrow_down
language keyboard_arrow_down
English
Français
Deutsch
日本語
search
print
link

Usage

view: view_name {
  dimension: field_name {
    link: {
      label: "desired label name"
      url: "desired_url"
      icon_url : "url_of_an_image_file"
    }
    # Possibly more links
  }
}

Hierarchy

link

Possible Field Types

Dimension, Measure

Accepts

Various parameters

Definition

The link parameter allows you to 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:

dimension: field_name { link: { label: "desired label name" url: "desired_url" icon_url: "url_of_an_image_file" } # Possibly more links }

The link parameter has several child parameters:

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:

dimension: id { primary_key: yes type: number sql: ${TABLE}.id ;; link: { label: "Contact Warehouse Support" url: "mailto:warehouse@brettcase.com" } }

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. If sql 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):

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:

dimension: artist_name { link: { label: "Google" url: "http://www.google.com/search?q={{ value }}" icon_url: "http://google.com/favicon.ico" } }

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:

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:

  1. Obtain the URL of the existing Explore to drill to.
  2. Add a link parameter to the City dimension:

dimension: city { type: string sql: ${TABLE}.city ;; link: { label: "City Metrics Explore" url: "https://instance_name.looker.com/explore/ecommerce_model/order_items_explore?fields=users.city,orders.count,users.count&f[users.city]=&sorts=orders.count+desc&limit=500" } }

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.

  1. 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:

dimension: city { type: string sql: ${TABLE}.city ;; link: { label: "City Metrics Explore" url: "https://instance_name.looker.com/explore/ecommerce_model/order_items_explore?fields=users.city,orders.count,users.count&f[users.city]={{ value }}&sorts=orders.count+desc&limit=500" } }

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:

dimension: name { link: { label: "Business Pulse By State Dashboard" url: "https://instance_name.looker.com/dashboards/694?State={{ _filters['users.state'] | url_encode }}" } }

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 has 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:

dimension: name { link: { label: "Average Order Profit Look" url: "https://instance_name.looker.com/looks/249?&f[users.state]={{ _filters['users.state'] | url_encode }}" } link: { label: "User Facts Explore Explore" url: "https://instance_name.looker.com/explore/ecommerce/users?fields=users.id,users.name&f[users.state]={{ _filters['users.state'] | url_encode }}" } }

Also note that you can pass multiple filters by placing & between them, such as in the URLs specified below:

dimension: name { link: { label: "Business Pulse By State Dashboard" url: "https://instance_name.looker.com/dashboards/694?State={{ _filters['users.state'] | url_encode }}&Date={{ _filters['orders.date'] | url_encode }}" } link: { label: "Average Order Profit Look" url: "https://instance_name.looker.com/looks/249?&f[users.state]={{ _filters['users.state'] | url_encode }}&f[orders.date]={{ _filters['orders.date'] | url_encode }}" } }

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:

measure: count { type: count_distinct sql: ${id} ;; drill_fields: [created_date, total_sale_price] link: { label: "Drill as scatter plot" url: " {% assign vis_config = '{\"type\": \"looker_scatter\"}' %} {{ link }}&vis_config={{ vis_config | encode_uri }}&toggle=dat,pik,vis&limit=5000" } }

See the More powerful data drilling Help Center article for more examples of customizing drill visualizations.

Additional resources

See the resources below for more information about using Liquid in Looker to create custom drilling experiences:

Top