How to embed your Mautic tracking code on your website

There are several ways of embedding the Mautic tracking code on your website.  We will cover the most common in this article.

Use an integration

If your website is powered by a Content Management System, it is likely that there is an integration plugin for Mautic.  Head over to https://www.mautic.org/integrations/ to find out if your system is supported.

Install the plugin and follow the setup instructions, and your resources will generally have the tracking code applied automatically.  To check this, view the source of your page (right click and then select view page source) and search for mtc.js - this is the Mautic javascript tracking.

Manually add your tracking code

If your website or application does not have an integration, or you wish to manually embed the tracking code, you need to access your Mautic instance to copy the tracking code.

Go to Mautic configuration > Landing Page Settings and copy the Javascript tracking code.  The code needs to be inserted before the closing </body> tag of the website or application you want to track.

Using Google Tag Manager

If you prefer, the Mautic tracking code can be deployed using Google Tag Manager by using the Custom HTML option and pasting the Javascript into the field.  Trigger the tag to fire on whatever pages you are interested in tracking.