# How to install OptiMonk Code via Google Tag Manager?

Canonical URL: https://support.optimonk.com/en/articles/how-to-install-optimonk-code-via-google-tag-manager

Installing OptiMonk through **Google Tag Manager** is a seamless process, and it is a good choice if:

- your website already uses Google Tag Manager, and
- your platform is not Shopify, Magento, WooCommerce or WordPress.

OptiMonk works perfectly well through Google Tag Manager on those platforms too, but the direct integrations give you more. They connect your **store**, not just the script — and that is what feeds the **Cart rules** targeting rule (*Cart value, item count, products (Shopify & co.)*) and the dynamic product recommendation modes (Most viewed, Last visited, Products in the cart, Smart recommendation), which each pick products live from your store's own data.

---

## Step 1 — Copy your snippet from OptiMonk

1. Log in to OptiMonk, open **Settings** and go to the **Domains** tab. (The same page opens from the domain switcher in the left sidebar, with **Domain settings** or **Install snippet**.)
2. If your site is not on the list yet, click **Add domain**, type it in (*Type a new domain, e.g. example.com*) and click **Add**.
3. Click the domain row to open it, then click **Connection guide**. Under **Connect your website** you first see the platform cards — scroll past them to the section headed **or install with Google Tag Manager** and pick **Google tag manager**.
4. The guide opens on step 1, **Get your unique JavaScript code from OptiMonk**: *To install OptiMonk, you need to copy and add the following OptiMonk JavaScript code to Google Tag Manager.* Click **Copy code**.

---

## Step 2 — Add the code to Google Tag Manager

Step 2 of the guide, **Add our code to your website via Google Tag Manager**, walks you through the same steps with screenshots. They are here too, for convenience:

1. Open a new tab, log in to your Google Tag Manager account and select the website you wish to implement OptiMonk on.
2. Select **Add a new Tag**.
3. Click on **Tag Configuration**, then select **Custom HTML**.
4. Click inside the HTML box and paste the OptiMonk code you copied (Ctrl + V, or right-click and Paste).
5. Click on **Triggering**.
6. Click on **All Pages**.
7. Finalize the changes by clicking **Save** in the top right corner.
8. Do not forget to click **Submit** to finish the setup.
9. You do not have to change anything on the next page — you can give a name to the changes, then click **Publish** in the top right corner.

---

## Step 3 — Check that the code is live

Back in OptiMonk, click **Check now** at the bottom of the guide. When everything is in place you get *The OptiMonk code is live on your-domain.com.*, and the domain row in **Settings → Domains** switches to **Code inserted**.

*Checking loads your site once and looks for the code — it does not need visitors.*

Other answers you may get:

- *We looked at your-domain.com and could not find the OptiMonk code yet. Make sure you saved your changes and the page is publicly reachable, then check again.* — the usual cause is a Tag Manager container that was saved but not **published**.
- *An OptiMonk code is on your-domain.com, but it belongs to a different account. Replace it with the code above.* — an old OptiMonk snippet from another account is still in the container.
- *We could not reach your-domain.com to check. This is on our side — try again in a moment.*

---

## If someone else manages your Tag Manager

Under **Do you need help?** in the guide, open **Send the instructions to my developer**: *We'll email them the snippet and what to do with it, so whoever looks after your-domain.com can paste it without an OptiMonk login.* Fill in **Their name** and **Their email address**, edit **The email they'll get** if you like, and click **Send the instructions**. You can send up to ten of these a day.
