# Cloudbeds

Adding Flip.to to your booking engine requires adding just one snippet of code to your booking engine.

{% hint style="warning" %}
**Before you begin:** you'll need your unique IDs, which you should have received by email. If not, ask our [Customer Success team](https://docs.flip.to/support/customer-success).
{% endhint %}

***

## Let's start

{% stepper %}
{% step %}

### Sign in to your Cloudbeds account

Then open the profile menu found in the top-right corner and look for **Settings**.

<figure><img src="/files/xzP4fUJP1RAJqO7LAi72" alt="" width="227"><figcaption></figcaption></figure>
{% endstep %}

{% step %}

### Go to Settings

Click on **Booking Engine** on the left, then the **Customize** tab.

<div data-full-width="true"><figure><img src="/files/zCjI4s1NPeN3GfiohXdL" alt=""><figcaption></figcaption></figure></div>
{% endstep %}

{% step %}

### Add the Flip.to snippet

Modify the following snippet to include your unique IDs for `COMPANY_CODE` and `PROPERTY_CODE` and paste it into the **Javascript** section.&#x20;

```javascript
<!-- Flip.to - Booking Engine Integration -->
<script>
!function(w,f){
    var COMPANY_CODE = 'CHANGE_ME';
    var PROPERTY_CODE = 'CHANGE_ME';

    w.addEventListener("on-booking-engine-ready", bookingEngineReadyListener);            
    function bookingEngineReadyListener(e) {
        // Flipto Every Page Snippet
        (w[f]=w[f]||[]).push({flipto:{
            bookingEngine: 'cloudbeds',
            companyCode: COMPANY_CODE,
            code: PROPERTY_CODE,
            language: document.documentElement.lang
        }, event: 'flipto.configuration.load'});

        // Set up Confirmation Page handler
        if (e && e.detail && e.detail.eventSystem) {
            e.detail.eventSystem.addEventListener("reservation-created", reservationCreatedListener);
        }
    };

    function reservationCreatedListener(e) {
        // Flipto Confirmation Page Snippet
        (w[f]=w[f]||[]).push({flipto:{
            bookingEngine: 'cloudbeds',
            companyCode: COMPANY_CODE,
            code: PROPERTY_CODE,
            confirmation: e.booking_id,
            first: e.resRooms[0].guest_first_name,
            last: e.resRooms[0].guest_last_name,
            startDate: e.checkin_date,
            endDate: e.checkout_date,
            adults: e.resRooms.reduce((acc,room) => acc+(+room.adults), 0),
            children: e.resRooms.reduce((acc,room) => acc+(+room.kids), 0),
            type: e.resRooms[0].room_type_name,
            rateCode: e.resRooms[0].rate_id,
            language: document.documentElement.lang,
            currency: e.currency_code,
            amount: e.resRooms.reduce((acc,room) => acc+(+room.total), 0) + e.total_tax,
            addonAmount: e.booking_total - e.resRooms.reduce((acc,room) => acc+(+room.total), 0) - e.total_tax,
            dateFormat: 'yyyy-M-d',
            eventData: {
                category: 'Booking_Engine',
                action: 'Load',
                value: e.booking_total
            }
        },event:'flipto.confirmation.load'});
    }
}(window,'fliptoDataLayer')
</script>
<script async src='https://integration.flip.to/K2X4KDP'></script>
<!-- Flip.to - End Booking Engine Integration -->
```

{% endstep %}
{% endstepper %}

And you're all set! If we can be of any help, say hello to our [Customer Success team](https://docs.flip.to/support/customer-success).


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.flip.to/developers/integrations/booking-engines/vendors/cloudbeds.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
