> For the complete documentation index, see [llms.txt](https://docs.flip.to/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.flip.to/docs/integrations/booking-engines/vendors/selfbook.md).

# Selfbook

Adding Flip.to to your Selfbook booking engine is done in just two steps.

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

{% hint style="info" %}
This is a Google Tag Manager integration. While putting code directly on the page is more reliable, this is the publicly documented way of integrating with Selfbook: [Selfbook GTM Data Layer Documentation](https://drive.google.com/file/d/11jxXwX7EJqa3AojWtW2GIVpr12qVmnkd/view)
{% endhint %}

***

## Step 1: Booking engine snippet

This is the first of two snippets to add to your RevRaise booking engine.

* Create a new tag in **your Google Tag Manager** that runs on the booking engine and set the trigger to:

```
Selfbook - Opened
```

* Copy and paste the snippet below into your new tag
* Replace **`XX`** with your **Flip.to** **companyCode** (be sure to keep the single quotes)

```javascript
<!-- Flip.to - Booking Engine Integration -->
<script>
!function(w,d,s,l,i,f,n){
(w[l]=w[l]||[]).push({flipto:i});
f=d.getElementsByTagName(s)[0];
n=d.createElement(s);n.async=!0;n.src=
'https://components.flip.to/discovery/engine/'+i.companyCode+'-'+i.code;
f.parentNode.insertBefore(n,f);
}(window,document,'script','fliptoDataLayer',{
	bookingEngine: 'Selfbook',
	companyCode: 'XX',
	code: '{{Selfbook - DLV - Hotel ID}}'
});
</script>
<script async src='https://integration.flip.to/K2X4KDP'></script>
<!-- Flip.to - End Booking Engine Integration -->

```

***

## Step 2: Confirmation page snippet

This snippet should only fire only on the confirmation page.

* In the same Google Tag Manager container as Step 1, create a new tag and set the trigger to either:

```
Selfbook - Purchase - itinerary_id 
```

```
Selfbook - Purchase - booking_id
```

* Copy and paste the snippet below into your new tag
* Replace **`XX`** with your Flip.to **companyCode** (be sure to keep the single quotes)

```javascript
<!-- Flip.to - Confirmation Page -->
<script>
  !function(n,e,w){
    w.eventData={category:'Booking_Engine',action:'Load',value:w.amount};
    (n[e]=n[e]||[]).push({flipto:w,event:'flipto.confirmation.load'});
  }(window,'fliptoDataLayer',
  {
    bookingEngine: 'Selfbook',
    companyCode: 'XX',
    code: '{{Selfbook - DLV - Hotel ID}}',
    confirmation: '{{Selfbook - DLV - Transaction ID}}',
    startDate: '{{Selfbook - DLV - Arrival Date YYYY-MM-DD}}',
    endDate: '{{Selfbook - DLV - Departure Date YYYY-MM-DD}}',
    guests: {{Selfbook - DLV - Total Guest Qty}},
    adults: {{Selfbook - DLV - Adult Qty}},
    children: {{Selfbook - DLV - Child Qty}},
    type: '{{Selfbook - DLV - Item Variant}}',
    rateCode: '{{Selfbook - DLV - Group Code}}' || '{{Selfbook - DLV - Promo Code}}',
    language: 'en',
    currency: '{{Selfbook - DLV - Currency}}' || 'USD',
    amount: {{Selfbook - DLV - Revenue}},
    dateFormat: 'yyyy-M-d'
  });
</script>
<!-- Flip.to - End Confirmation Page -->
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## 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, and the optional `goal` query parameter:

```
GET https://docs.flip.to/docs/integrations/booking-engines/vendors/selfbook.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
