# Embed events

## Actions/Events

You can listen to an event that occurs in embed as follows. We use the term Action and Event interchangeably. Though the technically better term is `event`, it can be confused with booking events or event-types.

```html
<script>
Cal("on", {
  action: "ANY_ACTION_NAME",
  callback: (e)=>{
    // `data` is properties for the event.
    // `type` is the name of the action(You can also call it type of the action.) This would be same as "ANY_ACTION_NAME" except when ANY_ACTION_NAME="*" which listens to all the events.
    // `namespace` tells you the Cal namespace for which the event is fired/
    const {data, type, namespace} = e.detail;
  }
})
</script>
```

### Following are the list of supported events that embed fires.

<table><thead><tr><th width="209.33333333333331">Action</th><th>Description</th><th>Properties</th></tr></thead><tbody><tr><td>eventTypeSelected</td><td>When user chooses an event-type from the listing.</td><td>eventType:object // Event Type that has been selected"</td></tr><tr><td>bookingSuccessful</td><td>When the booking is successfully done. It might not be confirmed.</td><td>confirmed: boolean; //Whether confirmation from organizer is pending or not  <br><br>eventType: "Object for Event Type that has been booked";  <br><br>date: string; // Date of Event  <br><br>duration: number; //Duration of booked Event  <br><br>organizer: object //Organizer details like name, timezone, email</td></tr><tr><td>linkReady</td><td>Tells that the link is ready to be shown now.</td><td>None</td></tr><tr><td>linkFailed</td><td>Fired if link fails to load</td><td>code: number; // Error Code <br><br>msg: string; //Human Readable msg  <br><br>data: object // More details to debug the error</td></tr><tr><td>__iframeReady</td><td>It is fired when the embedded iframe is ready to communicate with parent snippet. This is mostly for internal use by Embed Snippet</td><td>None</td></tr><tr><td>__windowLoadComplete</td><td>Tells that window load for iframe is complete</td><td>None</td></tr><tr><td>__dimensionChanged</td><td>Tells that dimensions of the content inside the iframe changed.</td><td>iframeWidth:number, iframeHeight:number</td></tr></tbody></table>

{% hint style="info" %}
Events that start with \_\_ are internal.
{% endhint %}

To get more details on how Embed actually works, you can refer to this[ Embed Flowchart](https://www.figma.com/file/zZ5oaUpg12Fuu5mGZrPlP5/Embed-Flowchart)


---

# 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://calcom.gitbook.io/docs/core-features/new-docs-embed/embed-events.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.
