Installing Madlitics on WordPress

WordPress powers a massive part of the internet — from blogs and small businesses to enterprise websites. If you’re using it, you’re in good company. Adding code to your WordPress site’s <head>
is one of those common tasks almost every marketer runs into. It might sound technical, but it’s actually pretty straightforward — especially when you’ve got the right guide.
The only thing to watch for? Not all WordPress sites work the same. Some are built on WordPress.com, the managed, hosted version, while others run on WordPress.org, the open-source version that lets you customize every detail. Whichever one you’re using, Madlitics makes it simple. In this guide, we’ll show you multiple ways to install the Madlitics code snippet — no stress, no headaches — so you can start capturing accurate attribution data without breaking a sweat.
Before jumping into the install steps, it’s important to know which version of WordPress your site is built on — because it determines which installation methods are available.
• WordPress.com is the hosted version. It’s simple, secure, and handles the technical stuff for you — but limits direct access to the site’s code. To add code to your header, you’ll need to use a plugin, and only if you’re on a Business plan or higher.
• WordPress.org is the open-source, self-hosted version. It gives you full control over your site’s code, themes, and plugins. If you’re using WordPress.org, you have several options for adding the Madlitics snippet — including adding it directly to your theme’s code if you’d like.
Not sure which one you’re using?
If you log in at wordpress.com, you’re likely using the hosted version. If you’re managing your site through your own hosting provider, you’re working with WordPress.org.
Before you can add Madlitics to WordPress (or any site), you’ll need to create a Madlitics account and grab your installation snippet. Once you have your snippet, you’re ready to install it into WordPress.
Step 1. Create your Madlitics account
Sign up for a free trial on the Madlitics website to get started. Creating an account unlocks your dashboard, where you’ll manage your sites, view analytics, and access the code snippet you’ll need to install.
Step 2: Access your installation snippet
Once you’ve registered and logged in, you’ll land in your dashboard’s Get Started section. Here, you’ll find your unique Madlitics installation snippet, which is required to enable tracking on your site.
WordPress offers more than one way to add code to your site’s <head>
, and the best method depends on whether you’re using WordPress.com or WordPress.org. For most users, installing a plugin like WPCode is the simplest and most reliable option — it ensures your snippet loads across every page without editing theme files. If you prefer, advanced users on WordPress.org can add the snippet directly to their theme code. In the steps below, we’ll walk through both approaches.
Recommended — All versions of wordpress.
If your theme doesn’t offer a built-in way to add header code — or you just want the easiest, most reliable option — we recommend using the free Insert Headers and Footers by WPCode plugin. If you’re on WordPress.com, this will likely be your only option since direct access to the theme’s code is restricted.
Once saved, you’re good to go — the Madlitics code will load automatically across every page of your site. No theme edits, no coding experience needed, and your snippet will remain intact even if you switch themes or update WordPress.
For self-hosted wordpress sites — wordpress.org
Many premium themes — like Divi, Genesis, or Astra — offer a simple way to insert custom code into your site’s header, no plugin needed. If your theme has this feature, it’s often the fastest way to get Madlitics up and running.
<script type="text/javascript" src="https://cdn.madlitics.com/script/"></script>
⚠ Tip: If you ever switch to a different theme, you’ll need to repeat this step since custom code added via theme settings doesn’t carry over automatically.
No extra tools, no complex setup — just a quick and easy way to place the Madlitics snippet where it belongs.
header.php
For self-hosted wordpress sites — wordpress.org
If you’re comfortable editing theme files directly, you can manually insert the Madlitics snippet into your site’s header.php
file. This method gives you full control, but if you ever update your theme, you may need to re-add the code.
<head>
tag.<head>
tag⚠ Heads up: If you update or change your theme, you’ll need to manually repeat this step. Theme file updates can overwrite custom code.
For technically confident users, this option is direct and effective — just make sure you’re comfortable working inside theme files.
Works for all versions of wordpress — wordpress.com, worspress.org
If you’re already using Google Tag Manager (GTM) to manage your tracking codes, you’re in great shape. GTM lets you easily add the Madlitics snippet without touching your WordPress theme or installing additional plugins. With GTM, you can centralize all your tags — including Madlitics — and keep your site’s code clean and organized. Plus, it makes future updates a breeze, since you won’t need to log into WordPress every time you want to tweak or add tracking.
Want to go this route? We’ve got a step-by-step guide to walk you through the entire process:
Follow our Google Tag Manager setup guide →
⚠ Heads up: To use GTM on a WordPress.com site, you’ll need to be on the Business plan or higher to install the necessary GTM plugin.
Verifying your Madlitics installation
To confirm your installation, open your site in a browser and right-click anywhere on the page, then select Inspect (or use Cmd + Option + I
on Mac / Ctrl + Shift + I
on Windows). In the Elements tab, scroll to the <head>
section and look for your code snippet — such as the madlitics.com
script URL. If it’s there, your injection is active and ready to collect data.
https://yoursite.com/?utm_source=linkedin&utm_medium=paidsocial&utm_campaign=q1_promo
Adding Madlitics to WordPress is more straightforward than it might seem. Whether you use a plugin, your theme’s settings, or a manual edit, you have multiple reliable ways to get the snippet added — and once it’s in place, you’ll be collecting clean, first-party attribution data automatically. If you’re not sure which option is best for you, we recommend starting with the WPCode plugin. It’s beginner-friendly, quick to set up, and keeps your code safe even if you update or switch themes later.
No matter which method you choose, you’re now ready to start using Madlitics to make smarter, data-backed marketing decisions.