Skip to main content
Web reader is in beta and switched on for selected accounts.
The snippet is a small piece of HTML that puts the player on your articles. You paste it once into the template your articles use, and every article gets the player. It carries the site’s ID and the settings you saved, so copy it again after you change appearance or readings.

Before you start

  • Set up the site and give every reading a voice. See Set up a site.
  • You need to be able to edit your site’s article template, or ask your developer to.

Copy the snippet

1

Open the site's Setup tab

In Web reader, open the site and go to Setup.
2

Choose how it is installed

Under How it is installed, choose Floating or Inline. The choice changes the snippet below it and isn’t saved, so you can install the player differently on different pages.
3

Copy it

Click Copy snippet in the Getting this live checklist, or copy the snippet card. Copy embed code at the top of the site page and in the site’s menu in the list copies the floating version.
How it is installed set to Inline, the embed snippet for it, and the Overriding on one page tableHow it is installed set to Inline, the embed snippet for it, and the Overriding on one page table
This is the snippet for a new site with an English reading, as the app gives it:
data-projectid is your site ID, shown under the domain on the site page. The other attributes depend on your settings: data-languages appears when you offer more than one reading, data-accent when you changed the accent colour, data-label when you changed the launcher label.

Inline or floating

The floating button sits 24 pixels from the bottom corner, on the right on left-to-right pages and on the left on right-to-left pages.

Paste it into your site

1

Open your article template

Use the template every article is built from, not a single article, so one change covers them all.
2

Paste the snippet

For inline, paste it where the player should show, for example right after the headline. For floating, paste it anywhere inside <body>.
3

Publish and test

Open a published article and press play. The first play converts the article, and it shows on the site’s Conversions tab. The Getting this live checklist then shows Live.
Put one snippet on a page. If there are several, only the first is used. The page must be on the site’s domain or one of its subdomains. On any other domain the player shows “Domain not authorized”.

Override settings on one page

The snippet carries your saved settings. To make one page differ, change or add an attribute on that page’s snippet by hand. The Overriding on one page card under the snippet lists them. The player also reads these attributes: An attribute on the page always wins over the site’s saved setting. Longer custom CSS can go in a <style type="text/hamsa-player"> element inside the <div> instead of data-custom-css.

Single-page sites

The player follows page changes on sites built as single-page apps: when the address changes, it resets for the new article. If your app adds the <div hamsa-webreader> after the script has loaded, the player finds it on its own. You can also call window.__hamsaWebReaderMount() once the container is on the page.

What readers see when something is wrong

Good to know

  • The snippet doesn’t need an API key. The site ID is public in your page source; only pages on your domain can use it.
  • After you save new readings, theme, colours, accent, widget language or launcher label, copy the snippet again and replace it on your site. Voices and dictionaries apply without a new snippet.
  • While the site is inactive, the player plays nothing on any page.

Player appearance

Layouts, sizes and custom CSS.

Conversions and chunks

Check the articles readers have played.