Use the HYPERLINK
function to create clickable text and image links in tables. Report viewers can click these links to navigate to other pages in your report or on the web.
When users click an external link, Looker Studio displays a redirect notice.
Note: this feature is being released gradually. You might not see it right away.
Sample usage
Create a link to a product catalog page and display the item name as the anchor text:
Display an image of a product and link to that item's page in your catalog:
Syntax
HYPERLINK(URL, anchor_text)
HYPERLINK(URL, image)
Parameters
URL
- A field or an expression that evaluates to the URL data typeanchor_text
- A field or an expression that evaluates to the Text data typeimage
- A field or an expression that evaluates to the Image data type
How the HYPERLINK
function works
The HYPERLINK
function has two forms: The first form creates a text link field, and the second form creates an image link field. Text link fields have the Hyperlink data type, while image link fields have the Image Link data type in your data source. You can add these fields to tables in your reports to give users a way to navigate to other pages.
The HYPERLINK
function requires two parameters: the first parameter must be a URL. If the second parameter is a Text field or expression, the function creates a Hyperlink field. If the second parameter is an Image field or expression, the function creates an Image Link field.
The URL
parameter provides the link target (the href
portion of the link). The URL
parameter can come from existing URL fields in the data source, or the parameter can be an expression that builds URLs from other fields and functions.
The anchor_text
parameter specifies the linked text to display. The anchor_text
parameter can be from a Text data type dimension in your data source or any other expression that evaluates to the Text data type.
To create an Image Link field, provide an Image dimension in your data source or any other expression that evaluates to the Image data type in place of the image
parameter.
Supported protocols
The HYPERLINK
function supports the following protocols:
http
https
mailto
ftp
If you specify an unsupported protocol, the link opens a blank page. If you don't specify a protocol, the HYPERLINK
function prepends http:
to the URL.
Notes
You can't change the data type of Hyperlink fields.
To display a clickable link in a table that displays the full URL as the anchor text, you can also use the URL field type.
When users click an external link, Looker Studio displays a redirect notice.
Note: this feature is being released gradually. You might not see it right away.
Examples
Use HYPERLINK
to create a product catalog with pictures of the items that have been sold and links to individual product description pages.
Suppose you have a data set with the following fields:
- Item - The name of the product
- SKU - The product identifier
- Product Page - The URL of the product's description page
- Product Image - The URL of the picture of the product that you want to display
For example:
Item | SKU | Product Page | Product Image |
---|---|---|---|
Pen | 123 | https://example.com/products/product123.html | https://example.com/images/product123.jpg |
Notebook | 456 | https://example.com/products/product456.html | https://example.com/images/product456.jpg |
Coffee Cup | 789 | https://example.com/products/product789.html | https://example.com/images/product789.jpg |
Creating a data source from the previous example gives you the following fields:
Field | Type |
---|---|
Item | Text |
SKU | Text |
Product Page | URL |
Product Image | URL |
Example 1: Create text links to product pages
To display links to the product description pages, create a Product Link calculated field with this formula:
HYPERLINK(Product Page, SKU )
The data source now looks like this:
Field | Type |
---|---|
Item | Text |
SKU | Text |
Product Page | URL |
Product Image | URL |
Product Link | Hyperlink |
You can then add the Product Link field to a table in your report. This displays the data as clickable links.
Example 2: Build URLs using CONCAT
Building URLs with the CONCAT
function is useful when only part of the link path is present in a field or when you want to override or add more information to the link.
For example, you could use CONCAT
to combine a hardcoded page path with a product SKU to form a complete URL to your product description page:
HYPERLINK(CONCAT('http://example.com/productpages/product', SKU, '.html'), Item)
Example 3: Create clickable images
To add clickable images to a table, you also use the HYPERLINK
function but provide a URL as the first parameter and an Image field, or an IMAGE
function with a valid link to an image, as the second parameter. This creates an Image Link field.
In this example, the Product Page dimension holds the URL, and the IMAGE
function generates an Image field using a single hard-coded value:
HYPERLINK(Product Page, IMAGE("https://example.com/images/product789.jpg", "Coffee cup")
As a more realistic example, you might either create the Image field ahead of time and store it in your data source or use the CONCAT
function to build the image
parameter:
HYPERLINK(Product Page, IMAGE(CONCAT("https://example.com/images/"), SKU, ".jpg", Item))
Links and thumbnail images from YouTube
The YouTube Analytics connector automatically provides links and thumbnail image fields you can add directly to tables in your reports:
Field | Type | Description |
---|---|---|
Video Link | URL | The link to the video on YouTube |
Thumbnail Link | URL | The link to the video thumbnail image |
Thumbnail | Image | The thumbnail image |
Linked Thumbnail | Image Link | The thumbnail image formatted as a link to the video on YouTube |