# Embedding agreements without displaying a widget

{% embed url="<https://www.loom.com/share/410325c059894e8eba9060edc958cca0>" %}

To embed your policy on a website, you need to load one of our widgets to load the policy. However, if you aren't using our cookie widget, you would want to avoid unnecessary widgets to pop up. Luckily you can use any of our widgets in stead to activate the policy load.

In this example we'll use our newsletter widget as a non-showing dummy widget to load the policy.

### 1. Create a container element for the policy on your website

First we need to create a container for the policy. It is important that you give this container a unique CSS selector ID so we later can target this container.&#x20;

The container should be placed where you visually want to show the policy, as it will be loaded inside this container.

Here's how the container should look:

```
<div id="policy-container"></div>
```

{% hint style="info" %}
The ID can be anything unique. We suggest using something recognisable, matching the policy in question like for example:

*"dpa-container"* or *"privacy-policy-container"*
{% endhint %}

### 2. Create a dummy widget to load the policy

Secondly we need a dummy widget to load the policy.&#x20;

{% hint style="warning" %}
**If you do not have a subscription to our cookie-consent product,** please contact us for assistance with this step.
{% endhint %}

1. Go to app.openli.com and click widgets in the side menu.
2. In the top right corner click *"New widget"*
3. Select the cookie widget
4. click save and exit&#x20;

### 3. Setup the script that loads the policy

Finally you are ready to insert the script that loads the policy into the container.&#x20;

Make sure you have legal.js loading on the page:

```javascript
<script>
    !function(){var i,e,t,s=window.legal=window.legal||[];if(s.SNIPPET_VERSION="3.0.0",i="https://widgets.openli.com/v1/legal.js",!s.__VERSION__)if(s.invoked)window.console&&console.info&&console.info("legal.js: The initialisation snippet is included more than once on this page, and does not need to be.");else{for(s.invoked=!0,s.methods=["cookieConsent","document","ensureConsent","handleWidget","signup","user"],s.factory=function(t){return function(){var e=Array.prototype.slice.call(arguments);return e.unshift(t),s.push(e),s}},e=0;e<s.methods.length;e++)t=s.methods[e],s[t]=s.factory(t);s.load=function(e,t){var n,o=document.createElement("script");o.setAttribute("data-legalmonster","sven"),o.type="text/javascript",o.async=!0,o.src=i,(n=document.getElementsByTagName("script")[0]).parentNode.insertBefore(o,n),s.__project=e,s.__loadOptions=t||{}},s.widget=function(e){s.__project||s.load(e.widgetPublicKey),s.handleWidget(e)}}}();
</script>
```

And below that insert this script:

```javascript
<script>
    legal.load("DUMMY-WIDGET-PUBLIC-KEY")
    legal.document("#policy-container", "POLICY-PUBLIC-KEY")
</script>
```

{% hint style="warning" %}
Note that it is important here that the CSS selector matches the unique ID you gave the policy container in the first step.
{% endhint %}

You will find the policy's public key in your Openli account under Agreements:

![](/files/71krnm5nZqTmo7TcCBVG)

And you'll find the dummy widget's public key under Widgets:

{% hint style="warning" %}
**If you do not have a subscription to our cookie-consent product,** please contact us for assistance with this step.
{% endhint %}

![](/files/6WLcBsNQ2OQPYShkFTL3)

Once these two script are in, the page should load the policy automatically when opened and no widget is shown.


---

# 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.openli.com/docs/policy-and-agreement-management/embed-your-policies-and-legal-agreements/embedding-agreements-without-displaying-a-widget.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.
