NEW: Planner, the Gantt you can edit. 30% off until January 1 Get Planner

Widget Modal messages

A Modal is a window in the middle of the page on a dimmed backdrop. It takes focus until the visitor closes it with the cross, Esc or a click on the backdrop. Use it for the rare thing that must be read, such as a maintenance notice or a change of terms. For a small card beside the button use a Teaser.

A simple Modal

hdwDataLayer.push({ message: {
  id: 'maintenance', type: 'modal', size: 'small',
  title: 'Scheduled maintenance',
  text: 'The shop is read-only on Sunday, 02:00-03:00 UTC.',
  button: { url: 'https://example.com/status', label: 'Status page' }
} });

widget-modal-simple.png

Name Meaning
id Name for remembering what was shown. Required unless frequency is always
type modal
title The heading, plain text
text The body, plain text with line breaks kept. Not together with source
button { url, label }: one button that opens an http or https link in a new tab. An empty label shows "Learn more". Not together with source
size small (360 px), medium (default, 600 px) or large (900 px); never wider than the screen. A long body scrolls inside the window
delay, frequency As for a Teaser: seconds, and once (default), visit or always

A Modal has no url, article or articles key: the command is dropped with a warning in the browser console. The link is button.url.

A page as the content

hdwDataLayer.push({ message: { id: 'terms-change', type: 'modal', size: 'large', source: 'wiki:docs:Terms-change' } });

widget-modal-rich.png

With source the body is an article of the Widget catalog (a wiki or a CMS page), so a marketer edits the text without touching the site. Headings, images, tables, notes and buttons inside the article work, see Notes, buttons and votes in articles. The heading is your title, otherwise the title of the page; if the page starts with its own heading, write the page for the Modal without one. source cannot be combined with text or button. A page that cannot be shown within 10 seconds is dropped silently.

Rules

  • One message at a time. A new push replaces the visible or pending one; a push with the same id is ignored.
  • A Modal is not shown while the panel is open, and a Teaser is not shown while a Modal is visible or pending.
  • closeMessage: 'id' closes a Modal without an event. The cross, Esc and the backdrop send message_close; the button sends message_click with action: url.
  • The window traps the Tab key and returns focus to the element that had it.

Related articles

Was this article helpful? Yes  No