HYPERLINK

Create text or image links from your data.

The HYPERLINK function creates Hyperlink and Image Link fields in your data source. Hyperlink fields display text links in tables. Image Link fields display clickable images in tables.

In this article:

Syntax

HYPERLINK(URL, Link Label)

 

Parameters:

  • URL - a field or expression that evaluates to a URL.
  • Link Label - a field or expression that evaluates to Text or an Image.

How the HYPERLINK function works

The HYPERLINK function takes 2 parameters: a URL, and a link label. Both parameters are required.

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 Link Label parameter specifies the text or image to display in the table. To create a Hyperlink field, the Link Label parameter can be from a Text dimension in your data source, or any expression that evaluates to Text. To create an Image Link field, the Link Label parameter can be from an Image dimension in your data source, or any expression that evaluates to Image. Image fields are created by the IMAGE function.

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, http: is assumed and prepended to the URL.

The Type drop-down menu is disabled for Hyperlink and Image Link fields.

To display the full URL as a link, use the URL field type.

HYPERLINK Examples

Create links from URL and Text fields

Suppose you have a data set with the following fields:

  • Product Page Path: complete URL for product-description pages
  • SKU: product identifiers
  • Pageviews: traffic to each page

For example:

Product Page Path SKU Pageviews
http://my.company.com/productpages/product123.html 123 100
http://my.company.com/productpages/product456.html 456 400
http://my.company.com/productpages/product789.html 789 700

 

Creating a data source from this example gives you the following fields:

Field Type
Product Page Path URL
SKU Text
Pageviews Number

 

To display links to the product-description pages, create a SKU Link calculated field with this formula:

HYPERLINK(Product Page Path, SKU )

The data source now looks like this:

Field Type
SKU Link Hyperlink
Product Page Path URL
SKU Text
Pageviews Number

 

A table in your report that uses the SKU Link field displays the data as clickable links:

SKU Link Pageviews
123 100
456 400
789 700

Build URLs using CONCAT

Building URLs with the CONCAT function is useful when only part of the data is present in a field, or when you want to override part of the link.

This example uses CONCAT to build a complete URL from a YouTube Analytics data source that has the video IDs and titles, but not the video URLs:

HYPERLINK(CONCAT('https://www.youtube.com/watch?v=', External Video Id), Video Title)

This formula combines a literal URL (the quoted text) with the External Video Id field to build links to each of your videos. The video titles are clickable links.

HYPERLINK example report

Create clickable images

To create an Image Link field, 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 HYPERLINK parameter.

For example, to display YouTube thumbnails as clickable links in tables:

  1. Edit your YouTube Analytics data source
  2. Create a new calculated field (for example, Video URL)
  3. Use this formula to create a URL field:
CONCAT('https://www.youtube.com/watch?v=', External Video Id)
  1. Create a new calculated field (for example, Video Thumbnail)
  2. Use this formula to create an Image field:
IMAGE(CONCAT('https://i.ytimg.com/vi/', External Video Id, '/hqdefault.jpg'), Video Title)
  1. Create a new calculated field (for example, Clickable Thumbnail)
  2. Use this formula to create an Image Link field :
HYPERLINK(Video URL, Video Thumbnail)
  1. Use the Clickable Thumbnail field in a table to display clickable image links, as shown in the example below.

Image Link example report

Was this article helpful?
How can we improve it?