Website builders

Add your reviews to Squarespace

A code block puts your approved Mocha reviews anywhere on a Squarespace page. Check your plan first: Squarespace doesn't allow JavaScript in code blocks on every plan.

TL;DR in 5 steps

  1. In Mocha, go to “Embed” > “Widget”, choose a widget and click “Copy code”.
  2. On your Squarespace page, click “Edit” and add a “Code” block via “Add block”.
  3. Set the block's “Type” to “HTML” and paste the code.
  4. Click “Save”.
  5. Check the page in a private browser window, as Squarespace sometimes hides code while you're logged in.

Before you start

  • A Mocha space with at least one approved review. Without approved reviews the widget stays empty.
  • The embed code from your Mocha dashboard (see step 1).
  • Permission to edit your Squarespace site.
  • A Squarespace plan that allows JavaScript in code blocks (see the note below).

The code block places the widget straight into your page, exactly where the block sits. The widget runs in a sealed-off area (Shadow DOM): your template's fonts and colours don't change it, and it doesn't change your template.

Step by step

  1. Copy the code in Mocha

    Open your space in the Mocha dashboard and click “Widget” under “Embed” in the space navigation. Pick a widget under “Choose a widget”, adjust “Appearance” and “Layout” (“Options” for some widgets), then click “Copy code”.

    The copied code is a single script tag. Yours contains your space's identifier instead of “your-space”:

    HTML
    <script
      src="https://mocha.de/api/embed/your-space/widget.js"
      data-mode="wall"
      async></script>
  2. Add a code block

    In Squarespace, open the page where the reviews should appear and click “Edit”. Hover over the section you want and click “Add block” or “+”. Choose “Code” from the block menu.

  3. Paste the code

    Click the pencil icon on the block to edit it. Choose “HTML” in the “Type” menu and leave “Display Source” switched off. Then paste the Mocha code into the text field (Ctrl + V on Windows, Command + V on a Mac).

    Important: if “Type” is set to “JavaScript”, Squarespace displays the code as text instead of running it.

  4. Position the block and save

    Drag the block to the position and width you want. The widget uses the width of the block. Then click “Save”.

  5. Check the live site

    Open the page in a private browser window where you're not logged in to Squarespace. As a security measure, Squarespace sometimes doesn't show code in code blocks while you're logged in, even though visitors can see it. In the editor you can click “Preview in Safe Mode” instead. Check the page on a phone as well.

Alternative: iFrame

Below “Embed code” in the Mocha dashboard you'll find the expandable “iFrame embed” section. It shows your space's review wall page inside a frame with a fixed height. This can help if the script doesn't get along with your template.

Click “Copy” there and paste the iframe code into a code block with “Type” set to “HTML”, just like above. The height is set in the code under height (600 pixels); change the number if needed. Of your dashboard settings, the review wall page only takes over the theme (light or dark). Note that Squarespace only allows iframes in code blocks on the plans mentioned above as well.

If the widget doesn't appear

  • You're logged in: Check the page in a private browser window (see step 5).
  • The code shows as text: Set “Type” to “HTML” in the code block and switch off “Display Source”.
  • Plan without JavaScript: According to Squarespace, JavaScript in code blocks isn't available on the Basic plan.
  • Ajax loading: Some templates load pages via Ajax. Squarespace names this as a possible cause of problems with custom code and suggests disabling Ajax loading as a test.
  • No approved reviews: The widget only shows approved reviews. See approve reviews.
  • Space paused: If “Space is active” is switched off in the space's “Settings”, Mocha doesn't show the widget.

Frequently asked questions

Which Squarespace plan do I need for the Mocha widget?

The widget is JavaScript. According to the Squarespace help centre, JavaScript and iframes in code blocks are available on the Core, Plus and Advanced plans and some legacy plans, but not on the Basic plan. Plans change from time to time, so the current overview in your Squarespace account is what counts.

Why can't I see the widget in the Squarespace editor?

As a security measure, Squarespace sometimes doesn't show code in code blocks while you're logged in, even though visitors can see it. Open your site in a private browser window, or click “Preview in Safe Mode” in the editor.

The code shows up as text on my page. What's wrong?

The code block's “Type” menu is probably set to “JavaScript” or “CSS”, in which case Squarespace displays the code as text. Set “Type” to “HTML” and switch off “Display Source”.

Can I show the widget on several pages?

Yes. Add a separate code block with the code on each page. You can also use different widgets from the same space, for example a Slider on the home page and a Wall of Love on a dedicated reviews page.

Do I need to change the code when new reviews come in?

No. The widget loads your approved reviews live from Mocha on every page view. Newly approved reviews appear after about a minute, without any change in Squarespace.

Ready for your first reviews?

Start for free, no credit card needed. Your form is ready in minutes.

Sign up for free