# 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**](https://docs.openli.com/docs/documentation/legaljs-widget/collecting-cookie-consent/consent-state-api#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;

![](https://1919043541-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-LRMQvUsiQMLNstTU-cS%2Fuploads%2FEZRHmUoFNb91QhMFJBtg%2FScreenshot%202021-11-22%20at%2011.16.17.png?alt=media\&token=9eea62e0-3811-4d10-aec0-99b00fabcb11)

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

![](https://1919043541-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-LRMQvUsiQMLNstTU-cS%2Fuploads%2F55AmjjmZrEmL6ycwo3O8%2FScreenshot%202021-11-22%20at%2011.16.24.png?alt=media\&token=2342414e-8981-4bd3-bc4e-1dc041bafa92)

## 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.](https://1919043541-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LRMQvUsiQMLNstTU-cS%2F-MTuY6TxgWi1fy5pddtW%2F-MTuZVeWrIbXPQcai3ke%2FScreenshot%202021-02-19%20at%2014.49.40.png?alt=media\&token=4d946e17-98d8-41ee-8418-dde5807ebfaf)

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

![](https://1919043541-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LRMQvUsiQMLNstTU-cS%2F-MTuY6TxgWi1fy5pddtW%2F-MTuZi37RxnVIGU580ZR%2FScreenshot%202021-02-19%20at%2014.51.39.png?alt=media\&token=5356c7da-44b9-456d-bcda-e863645e5b8d)

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"**:

![](https://1919043541-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LRMQvUsiQMLNstTU-cS%2F-MTuY6TxgWi1fy5pddtW%2F-MTu_N3o1Pr9iTD9zmHW%2FScreenshot%202021-02-19%20at%2014.58.06.png?alt=media\&token=54d77bd5-fc16-45ec-aaf4-0b6793f2bc3f)

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](https://1919043541-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LRMQvUsiQMLNstTU-cS%2F-MTuY6TxgWi1fy5pddtW%2F-MTu_aNppLFtkUZM2FMv%2FScreenshot%202021-02-19%20at%2014.53.07.png?alt=media\&token=8e661925-087b-46dc-bc58-e4a9f3618473)

## 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;

![](https://1919043541-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-LRMQvUsiQMLNstTU-cS%2Fuploads%2FP5L9Hk7egE96nLzqpVuv%2Fcookie-openli.png?alt=media\&token=cc21774f-ca82-4bf0-9308-2a0b2cf7f9d1)
