Technical Documentation

Widget installation

Integrate the booking widget on your website in minutes

4 min min read

The booking widget lets your customers make bookings directly from your website.

Get the code

  1. Go to WidgetCode in the sidebar menu
  2. Choose the integration tab (Standalone is the recommended one)
  3. Click Copy code — your unique clientId is already included

Option 1: Standalone (recommended)

This is the fastest and most lightweight integration. Paste this code into your site wherever you want the widget to appear:

<!-- Reserva de Hamacas Widget (Standalone) -->
<div id="reserva-hamacas"></div>
<script src="https://cdn.reservadehamacas.com/widget/embed.js"></script>
<script>
  document.addEventListener('DOMContentLoaded', function () {
    ReservaHamacas.init({
      clientId: 'YOUR_CLIENT_ID',
      container: '#reserva-hamacas',
      locale: 'es',
      theme: {
        primaryColor: '#3B82F6'
      },
      onReservationComplete: function (data) {
        console.log('Reservation complete:', data);
        // Your code here (analytics, redirect, etc.)
      },
      onError: function (error) {
        console.error('Error:', error);
      }
    });
  });
</script>
Selecciona para copiar

You don't need to place it in the <head>: the <script> goes next to the <div> and the widget starts on its own when the page loads.

The main color and the widget texts are configured from WidgetCustomization in the panel. The primaryColor in the code is optional and acts as a fallback.

Option 2: Iframe (simple)

If your platform doesn't let you run scripts, use an iframe. It's the most compatible option:

<!-- Reserva de Hamacas Widget (Iframe) -->
<iframe
  src="https://reservadehamacas.com/embed/YOUR_CLIENT_ID"
  width="100%"
  height="900px"
  style="border: none; border-radius: 12px; box-shadow: 0 4px 6px rgba(0,0,0,0.1);"
  title="Book your sunbed"
  allow="payment"
></iframe>
Selecciona para copiar

The allow="payment" attribute is essential for payments to work inside the iframe.

Option 3: Direct link

Send your customers straight to your booking page, without installing anything:

https://reservadehamacas.com/your-company
Selecciona para copiar

If you haven't set up your company's friendly URL yet, use the link with your identifier:

https://reservadehamacas.com/embed/YOUR_CLIENT_ID
Selecciona para copiar

Use it in:

  • Emails
  • Social media
  • Printed QR codes

Community widget

If your plan includes the community widget (internal bookings, without prices or payments), the script and the global object are different:

<div id="reserva-hamacas"></div>
<script src="https://cdn.reservadehamacas.com/widget/embed-community.js"></script>
<script>
  document.addEventListener('DOMContentLoaded', function () {
    ReservaHamacasCommunity.init({
      clientId: 'YOUR_CLIENT_ID',
      container: '#reserva-hamacas',
      locale: 'es'
    });
  });
</script>
Selecciona para copiar

Specific integrations

WordPress

  1. Install the "Insert Headers and Footers" plugin (or similar)
  2. Paste the widget code in the footer section
  3. Create a new page for bookings
  4. Add the container <div>

You can also use a custom HTML block in the block editor.

Wix

  1. Go to your site editor
  2. Add an "Embed" > "Custom HTML" element
  3. Paste the complete widget code
  4. Adjust the container size

Squarespace

  1. Go to the page where you want the widget
  2. Add a "Code" block
  3. Paste the widget code
  4. Save and publish

Shopify

  1. Go to Online Store > Pages
  2. Create a new page
  3. Switch to the HTML editor
  4. Paste the widget code

Verify installation

  1. Visit the page where you installed the widget
  2. You should see the booking calendar
  3. Try making a test booking

Troubleshooting

The widget doesn't appear

  • Verify the clientId is correct
  • Check that the <div id="reserva-hamacas"> exists in the HTML
  • Review the browser console (F12) for errors

The widget appears but doesn't load data

  • Verify your account is active
  • Check that you have at least one published zone
  • Verify you have available sun loungers

CORS error

  • The widget must be loaded from a public domain
  • It doesn't work by opening the HTML file directly (file://)

Technical requirements

RequirementMinimum
Website width400px (800px height recommended)
JavaScriptEnabled
HTTPSRecommended
BrowsersChrome, Firefox, Safari, Edge (latest 2 versions)

Next step

Learn how to customize the widget with its configuration options.

Widget installation