> For the complete documentation index, see [llms.txt](https://docs.openli.com/docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.openli.com/docs/legacy-integrations/how-to-use-google-tag-manager-with-legal-monster/install-legal-monster-with-gtm.md).

# Install Openli with GTM

{% hint style="warning" %}
This courtesy guide is **no longer actively tested** by Openli, although it might still work.

Our cookie-consent widget intentionally uses a highly-compatible, highly-generic approach to integration. In most cases, it will be possible for your developers to adapt this guide's steps to any changes that might have been made to the target platform, in combination with their own general documentation. **Our** [**consent-state events**](/docs/documentation/legaljs-widget/collecting-cookie-consent/consent-state-api.md#listening-for-consent-change-events) **might be useful for this.**
{% endhint %}

## Openli Cookie Pop-up&#x20;

You need your widget's install code to follow this guide. To find this code snippet, navigate to "Widgets" and click on "Install" for the widget, you wish to use.&#x20;

![](/files/9E1rSqu6d4mwDLW7dqNz)

This is the code you'll need in this guide. We will refer to it as your "Openli **code snippet".**

![](/files/7vCIbCTDoOpDiPK6jAFj)

## Before you start:

Before following these steps, please be sure that you have:

* A [Google Tag Manager](https://tagmanager.google.com/) account
* [Installed Google Tag Manager on your site](https://www.youtube.com/watch?v=P4suvDuj0kI)
* Your Openli code snippet

## Step 1: Create a tag for the cookie widget

First you must create a tag for your cookie widget. Go to your Google Tag Manager dashboard and select "Add new tag". Choose **Custom HTML** for your tag type:

![You must select "Custom HTML" as your tag type.](/files/-MTuZVeWrIbXPQcai3ke)

Now you must paste your cookie code snippet in your tag:

![](/files/-MTuZi37RxnVIGU580ZR)

Lastly, you must setup a trigger for the Openli tag.

## Step 2: Create trigger

The trigger for Openli must be of the type *"Page view - DOM Ready"*, which means that the widget will load *after* all other content on your site.&#x20;

Press "Choose a trigger" and create a new trigger with the type **"DOM ready"**:

![](/files/-MTu_N3o1Pr9iTD9zmHW)

When you press save, you'll see that this trigger is now associated with your Openli tag:

![This is a correct setup for installing Openli with Google Tag Manager](/files/-MTu_aNppLFtkUZM2FMv)

## Done!

Congratulations on completing your first step towards collecting compliant cookie consent. Pat your self on the back and know that our privacy mascot Li is proud of you.&#x20;

![](/files/zs6pyohoGPpemrZGhYeD)


---

# 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.openli.com/docs/legacy-integrations/how-to-use-google-tag-manager-with-legal-monster/install-legal-monster-with-gtm.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.
