Skip to Content
Getting StartedInstallation

Installation

Detailed instructions for adding AttributionHub to your website.

Basic Installation

Add the script tag to the <head> of every page on your site:

<script src="https://cdn.attributionhub.com/attribution.js?id=YOUR_LICENSE_KEY" async defer ></script>

The async defer attributes ensure the script loads without blocking page rendering.

Installation with Custom Settings

To customize behavior, define settings before loading the script:

<script> window.attrhub = { settings: { enableLogging: false, customFields: ["product_tier", "referral_code"], }, }; </script> <script src="https://cdn.attributionhub.com/attribution.js?id=YOUR_LICENSE_KEY" async defer ></script>

See Configuration for all available settings.

Platform-Specific Guides

WordPress

Option 1: Theme header Add the script to your theme’s header.php file, inside the <head> tag.

Option 2: Plugin Use a plugin like “WPCode” or “Insert Headers and Footers” to add the script to your site header without editing theme files.

Option 3: functions.php

function add_attributionhub_script() { echo '<script src="https://cdn.attributionhub.com/attribution.js?id=YOUR_LICENSE_KEY" async defer></script>'; } add_action('wp_head', 'add_attributionhub_script');

Next.js

// app/layout.tsx import Script from "next/script"; export default function RootLayout({ children }) { return ( <html> <head> <Script src="https://cdn.attributionhub.com/attribution.js?id=YOUR_LICENSE_KEY" strategy="afterInteractive" /> </head> <body>{children}</body> </html> ); }

Webflow

  1. Go to Project Settings > Custom Code
  2. Paste the script tag in the Head Code section
  3. Click Save Changes
  4. Publish your site

Shopify

  1. Go to Online Store > Themes > Edit Code
  2. Open theme.liquid
  3. Paste the script tag before </head>
  4. Save

Google Tag Manager

  1. Create a new Custom HTML tag
  2. Paste the script tag
  3. Set trigger to All Pages
  4. Submit and publish
<script src="https://cdn.attributionhub.com/attribution.js?id=YOUR_LICENSE_KEY" async defer ></script>

Squarespace

  1. Go to Settings > Advanced > Code Injection
  2. Paste the script tag in the Header section
  3. Save

Wix

  1. Go to Settings > Custom Code
  2. Click Add Custom Code
  3. Paste the script tag
  4. Set placement to Head and apply to All Pages

Verifying Installation

After adding the script, verify it’s working:

  1. Open your site in an incognito browser window
  2. Open DevTools (F12) > Console
  3. Type localStorage.getItem('attrhub') and press Enter
  4. You should see a JSON object with attribution data

If you see null, try navigating to your site with test UTM parameters:

https://yoursite.com/?utm_source=test&utm_medium=cpc&utm_campaign=verification

Self-Hosted Installation

If you prefer to host the script yourself:

  1. Download the latest attribution.js from your AttributionHub dashboard
  2. Host it on your own CDN or server
  3. Update the src attribute in your script tag to point to your hosted version

Note: Self-hosted scripts still perform license validation. You need a valid license key to use AttributionHub.

Troubleshooting

Script not loading

  • Check browser DevTools > Network tab for any blocked requests
  • Verify your ad blocker isn’t blocking the script
  • Ensure the license key is correct

No data in localStorage

  • Make sure you’re testing in an incognito window (existing data may interfere)
  • Check the Console tab for any error messages
  • Verify the script URL is correct and accessible

Forms not populating

  • Ensure hidden fields exist in the form DOM before AttributionHub initializes
  • Check that field names match (e.g., ah_lt_channel, ah_lt_source)
  • See Form Integrations for platform-specific requirements