Install Madlitics on HubSpot-Hosted Websites and Landing Pages

Add your Madlitics snippet to your HubSpot website’s header to capture original channel, campaign, and landing page attribution.
Attribution is broken

Install Madlitics on your HubSpot-hosted website by adding your installation snippet to Site Header HTML in HubSpot’s settings.

This guide covers where to find your snippet and how to add it to your website. Once installed, configure your HubSpot forms so captured attribution reaches your contact records.

Get your Madlitics installation snippet

‍

Step 1: Create or sign in to your account

Create your Madlitics account, or sign in if you already have one. Complete your website setup before copying the installation snippet.

‍

Start by signing up for a FREE Madlitics trial to begin capturing attribution data.

‍

Fill out the registration form to create your account and unlock your dashboard

‍

Step 2: Copy your snippet

In your Madlitics dashboard, open Get Started and copy your installation snippet from Step 1.
Copy the complete snippet exactly as provided.

‍

Locate your unique installation snippet in the dashboard under Get Started → Step 1 → Copy Code Snippet.

Access HubSpot settings

With your Madlitics snippet copied, the next step is getting it into HubSpot so attribution runs across all of your hosted pages. HubSpot lets you add scripts globally using the site header HTML, enabling the Madlitics snippet to run across your HubSpot‑hosted website and landing page once published.
‍

Step 3: Select your website domain

In HubSpot, click the Settings icon in the top navigation, then open Content → Pages.

Use Choose a domain to edit its settings to select the domain where you want to install Madlitics.

Check whether the domain uses the default header settings or its own override before adding your snippet.
‍

Click the Gear icon in the upper right to access the HubSpot settings

‍

Scroll to the bottom of the settings options Tools → Content → Pages

Add the Madlitics snippet

Step 4: Paste your snippet into Site Header HTML

Paste the Madlitics snippet into this field, enabling Madlitics to load on every HubSpot-hosted page, including landing pages and website pages. Click Save to apply your changes.

Then, create a new or use an existing HubSpot‑hosted page and click Update or Publish. This pushes the script live and activates Madlitics across your site, so every visitor — including those who submit HubSpot‑hosted lead or embedded forms — can pass attribution data into your contact records.

For detailed instructions on setting up Madlitics with HubSpot-hosted forms and lead submission flows:
‍HubSpot-hosted setup guide: Setting up HubSpot-hosted pages and forms to collect marketing attribution.
mnbmn

Add your complete Madlitics snippet to Site Header HTML, preserving any existing code, then click Save. Create a new or use an existing HubSpot‑hosted page and click Update or Publish.

‍

Paste your complete Madlitics snippet into Site Header HTML and click Save.

‍

Navigate to your HubSpot-hosted page, or create a new one, embed lead forms, etc.

‍

Click 'Update' to push the script live and activate Madlitics across your site

Check your installation

Open your published HubSpot-hosted website after saving the snippet.

Right-click the page, select Inspect, and open the Console tab. Reload the page and look for the Madlitics status message.

A Madlitics OK message confirms a successful script status check. Your forms still need the configured attribution fields to send captured data into HubSpot.
‍

Madlitics OK confirms a successful script status check on the published page.

‍

Troubleshooting: 
• If there is NO Madlitics messaging, the script may not have been published to the live site or you may be seeing a caching issue.
• If there is a different message from Madlitics, there may be an issue with the account, plan tier, domain, etc. Feel free to reach out to the team, we're here to help.

‍

‍

Next: Connect attribution to your HubSpot forms

With Madlitics installed, configure the hidden attribution fields in your HubSpot forms and connect them to contact properties.

Each configured submission can then carry the visitor’s original channel, campaign segments, and landing page data into HubSpot alongside their contact information.

Set up attribution fields on HubSpot-hosted pages

Stacked bar chart showing lead generation by marketing channel over time, comparing sources like Paid Search, Paid Social, Organic Search, Direct, and Email. Helps visualize which channels drive the most traffic.
Line chart displaying lead-to-customer conversion rates by channel, comparing Google Ads, Facebook Ads, LinkedIn Ads, Organic Search, and Email. Shows how different sources drive qualified leads over time.
Line chart showing revenue performance by marketing campaign, comparing Google Ads, Facebook Ads, and LinkedIn Ads. Helps identify top-performing and underperforming campaigns.

Related articles

HubSpot’s hosted websites and landing pages give you the flexibility to design and launch polished campaigns without leaving your CRM — while still letting you add the scripts that power your marketing stack. Adding the Madlitics snippet to your HubSpot site header ensures every visitor interaction is captured as clean, first‑party attribution data, directly tied to your contacts and reports.

That means you’ll know exactly which channels, campaigns, and pages are driving leads and pipeline, with attribution flowing automatically into your HubSpot contact records, reports, and dashboards.

If you’d like a hand getting started, our team’s here to help. We’ll walk you through the setup so you can focus on building, while Madlitics takes care of the attribution.

Frequently asked questions

Answers to common questions about installing Madlitics on HubSpot