> For the complete documentation index, see [llms.txt](https://docs.optibase.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.optibase.io/features/conversions/connect-a-conversion.md).

# Connect a Conversion

*If you using Webflow, then you should follow the guide here:* [Optibase Webflow App](/webflow-app/optibase-webflow-app.md)

Once you’ve created a Conversion inside the Optibase web app, you’ll need to connect it to your website so Optibase can track when it happens.

### Why connection matters

Some conversion types (like clicks and form submissions) rely on being linked to specific HTML elements.

Others (like page views or scroll depth) work based on the URL alone and don’t need any extra setup in your code.

***

### Click Event

If you want to trigger a conversion when a user clicks an HTML element (like a button or link), you need to:

1. Go to the Conversions page in the Optibase app
2. Find the Click Conversion you created
3. Copy the data-optibase-click-conversion-id from the table
4. Add that attribute to the element on your website

Before:

```
<button>Sign Up</button>
```

After:

```
<button data-optibase-click-conversion-id="sign_up">Sign Up</button>
```

This tells Optibase to fire the “sign\_up” conversion when this element is clicked.

***

### Submit Event

If you want to trigger a conversion when a user submits a form, follow the same steps, but use the data-optibase-submit-conversion-id attribute:

1. Copy the ID from your Submit Conversion in the dashboard
2. Add it to the \<form> element

Before:

```
<form>
  ...
</form>
```

After:

```
<form data-optibase-submit-conversion-id="sign_up">
  ...
</form>
```

Optibase will now send a conversion event when the form is submitted.

***

### Programmatic Conversion

This type of conversion is triggered via JavaScript or your backend, not by clicking or submitting elements.

Use this when:

* You need full control over when a conversion is triggered
* The conversion happens outside the DOM (e.g. Stripe payment, API response)

Trigger it using:

```
optibaseSendConversionEvent('sign_up')
```

You can set up a Programmatic Conversion with Google Tag Manager: [Trigger Conversions with GTM](https://docs.optibase.io/integrations/trigger-conversions-with-gtm)

You can also trigger this conversion from the server: [Server-side Conversions](https://docs.optibase.io/how-to-setup-optibase/server-side-conversions)

### Page View, Scroll Depth, and Time on Page

These conversion types do not require any changes to your HTML.

They work automatically based on the URL and settings you define when creating the conversion:

* Page View: Fires when the page loads
* Scroll Depth: Fires when the user scrolls to a certain depth
* Time on Page: Fires after the user spends a set amount of time on the page

Just make sure the script is installed, and Optibase handles the rest.


---

# 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.optibase.io/features/conversions/connect-a-conversion.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.
