Skip to main content

Install the Monfri script on your site

One tag on every page — pasted, through Google Tag Manager or with your store's plugin — and how to check that it works.

M
Monfri Team
Updated ·3 min read

The Monfri script is what lets CDP see your visitors — page views, products they look at, carts, orders, articles they read — and what shows your web push prompt and your chatbot. You install it once; everything else is switched on from Monfri.

Running a store on CloudCart, WooCommerce, Shopify, OpenCart or Magento? Connect the store — see Connect your online store — and add the tag: the connection brings products, customers and orders, the tag what happens on the site. On WooCommerce the Monfri plugin adds it for you; elsewhere, the steps below.

Get your tag

Either place gives the same tag, with your own key already in it:

  • the setup guide in the Hub, step Your data;
  • in CDP, Settings → Tracking & SDK: enter the Domain, choose the Site type, click Generate tracking script, then Copy under Install this script. See Sites in CDP: the domains that send you data.

It looks like this:

<script async src="https://cdp.monfri.net/sdk/monfri.global.js" data-key="YOUR_WRITE_KEY"></script>

The key in it is made to sit in public page code: it can send events to your workspace and fetch the site's settings and recommendations, but it cannot read your customers' data.

Option 1: paste the tag

Paste the tag on every page of your site — in the <head>, or just before the closing </body> tag. Most site builders and themes have one place for "header code" or "footer code" that applies to every page.

Option 2: Google Tag Manager

  1. In Google Tag Manager, add a new Custom HTML tag.
  2. Paste the same tag and set the trigger to All Pages.
  3. Publish the container.

Check that it works

Open your site in another tab and click around. In CDP, Verify installation checks every 5 seconds and says Tracking is working as soon as the first events arrive — usually within a minute. The setup guide in the Hub turns its step green at the same moment, and the dashboard's checklist marks Connect your website as done.

Nothing arriving? See Check that tracking works, and fix it when it does not.

You do not paste it twice

The tag never changes. When you change the site type or the tracking settings in CDP, the script on your site reads them by itself — see Sites in CDP: the domains that send you data. Paste it again only if you remove it.

Browser notifications (optional)

The same tag starts web push: a small banner, and on Allow a window on push.monfri.net where the browser asks for permission. There is nothing more to install — see Web push.

Didn't find your answer?

Write to us and tell us what you were trying to do.