Tracking script

After installation and setup of the Cron jobs you’re ready to begin tracking Contacts. You need to add a piece of JavaScript to the websites for each site you wish to track through Mautic.

This is a straightforward process. You can add this tracking script to your website template file, or install a Mautic Integration for the more common content management system platforms.

To open Tracking Settings:

  1. Click the settings wheel in the top right corner to open the Settings menu

  2. Go to Configuration

  3. Select Tracking Settings.

See Mautic configuration settings for more information about the Configuration area. Copy the exact code from Tracking Settings in the Global Configuration. Place the Full tracking script or the essential script just before the closing </body> tag. The tracking add-on is the exception: run it from your consent manager’s callback after the visitor consents, as described in the Consent-managed tracking section below.

Mautic offers two setup options:

  • A single all-in-one script

  • Two separate scripts for consent-managed setups.

Mautic tracks Landing Pages automatically, so you only need these scripts on third-party websites.

Choosing a tracking setup

Tracking Settings presents both options as tabs. Pick the one that matches how your site handles consent:

  • Full tracking: use this when there’s no separate consent gate, or when you handle consent elsewhere. It loads Contact tracking immediately.

  • Consent-managed: use this when a consent manager gates tracking and cookies. For every visitor, the essential script keeps the Dynamic Content fallback content, the default content you configure, visible and initializes Forms inside those fallback slots. Personalized Dynamic Content and Contact tracking wait until the visitor consents.

Full tracking

The Full tracking tab gives you a single all-in-one script. It loads the essential runtime, then the tracking add-on, so it starts tracking Contacts immediately. Use it when your site has no separate consent gate, or when you handle consent elsewhere. This behaves like all-in-one tracking has always worked.

Copy the exact code from the Full tracking tab in Tracking Settings. The copied snippet already contains your instance’s Site URL.

Existing /mtc.js embeds keep working unchanged, so you don’t need to update sites that already use them.