Product

How to Add Website Visitor Identification to WordPress

Install Leadpipe on any WordPress site to identify anonymous B2B visitors. Setup via header script or plugin, plus routing and testing steps.

Nicolas CanalNicolas Canal··8 min read
How to Add Website Visitor Identification to WordPress

WordPress powers a huge share of B2B marketing sites — and most of them leak demand. Around 97% of B2B website traffic is anonymous, which means the vast majority of the people reading your services page, comparing plans, or downloading a guide leave without ever filling a form.

You can fix that on WordPress in about ten minutes. Adding person-level website visitor identification to WordPress is just a matter of loading one lightweight JavaScript snippet on every page — and WordPress gives you three clean ways to do it.

This guide walks through all three install methods (header script, a header-and-footer plugin, and Google Tag Manager), plus how to handle WooCommerce, route the identified visitors somewhere useful, and confirm the whole thing is actually firing before you move on.


What “adding Leadpipe to WordPress” actually means

Leadpipe identifies anonymous visitors by loading a small script on your pages. When a US B2B visitor lands, Leadpipe matches their signals deterministically against its own proprietary identity graph and — when there’s a verified match — returns a named contact with work email, company, title, LinkedIn, and the pages they viewed. No form, no guessing. When there’s no verified match, it returns nothing rather than a bad guess.

For WordPress, that means you are not installing a heavy platform. You are adding one async <script> tag that:

  • Loads on every page of the site (not just the homepage).
  • Runs asynchronously, so it never blocks your theme from rendering.
  • Fires once per pageview and reports behavior back to your dashboard.

Your exact snippet — with your unique site ID — is in your Leadpipe dashboard under Install. It looks something like this:

<script
  src="https://cdn.leadpipe.com/v1/lp.js"
  data-site="YOUR_SITE_ID"
  async
></script>

Copy the real one from the dashboard; don’t retype the example above. Then pick one of the three install paths below.

In one sentence: Adding Leadpipe to WordPress is a one-snippet, site-wide install — the only real decision is where you paste it.


The three ways to install on WordPress

Method Best for Dev needed? Survives theme updates?
Header-and-footer plugin Most WordPress sites No Yes
Google Tag Manager Sites already running GTM No Yes
Theme header (direct edit) Devs with a child theme Some Only via child theme

For the majority of teams, the plugin method is the right call: it’s the fastest, it requires no code, and it doesn’t get wiped when your theme updates. Use the direct theme edit only if you already work in a child theme and prefer to keep everything in version control.


WordPress doesn’t ship with a built-in “add code to <head>” field, so the cleanest no-code route is a small header-injection plugin. Popular, well-maintained options include WPCode (formerly Insert Headers and Footers) and similar “header and footer scripts” plugins. Any of them work the same way.

  1. Install and activate your header-and-footer plugin from Plugins → Add New.
  2. Open its settings (often under Settings → Insert Headers and Footers or Code Snippets → Header & Footer).
  3. Paste your Leadpipe snippet into the Header (<head>) box so it loads early on every page.
  4. Save. That’s it — the script is now on every published page site-wide.

Because the snippet lives in a plugin and not your theme files, it stays put through theme changes and updates. This is the setup we recommend for most marketing teams who don’t want to touch code again.

If you’d rather not manage a separate plugin at all, jump to the GTM method below — it’s just as clean and keeps all your tags in one place.


Method 2: Install through Google Tag Manager

If your WordPress site already loads Google Tag Manager, you don’t need a WordPress plugin at all — deploy Leadpipe as a Custom HTML tag inside GTM. This keeps every marketing tag in one container and lets non-developers manage it.

The short version: create a Custom HTML tag, paste your snippet, and fire it on All Pages (Page View). Because GTM has consent controls built in, this is also the easiest place to gate the tag by consent state if you serve EU traffic.

We wrote a full step-by-step for this — see Install Website Visitor Identification with Google Tag Manager for the trigger configuration, consent-mode notes, and how to debug it in Preview mode. If you run GTM, use that guide instead of editing WordPress directly.


Method 3: Edit the theme header directly

If you maintain a child theme and prefer code over plugins, add the snippet to your header template.

  1. In your child theme, open (or create) header.php.
  2. Paste the Leadpipe snippet just before the closing </head> tag.
  3. Save and deploy.

Always use a child theme for this. If you edit the parent theme’s header.php directly, the next theme update overwrites your change and silently kills identification. A child theme (or a wp_head hook in your functions.php) survives updates.

// In a child theme functions.php — cleaner than editing header.php
add_action( 'wp_head', function () { ?>
  <script src="https://cdn.leadpipe.com/v1/lp.js" data-site="YOUR_SITE_ID" async></script>
<?php } );

This is the most “developer-native” option, but for a marketing site it’s usually overkill. The plugin or GTM route gets you the same result without touching PHP.


A note on WooCommerce and membership sites

If your WordPress site runs WooCommerce, a membership plugin, or any logged-in experience, a couple of things are worth knowing:

  • The script belongs site-wide, including WooCommerce pages. Product, category, and cart pages are where high-intent B2B and wholesale buyers browse — exactly the visitors you want identified. Don’t restrict the snippet to marketing pages only.
  • Leadpipe identifies anonymous visitors, not your logged-in members. For already-authenticated users you already have the contact record, so there’s no conflict. Identification does its work on the anonymous, pre-login traffic — the wholesale buyer comparing bulk pricing who never creates an account.
  • B2B ecommerce is a strong fit. If you sell to businesses through WooCommerce, pair this with the anonymous ecommerce visitors guide and our B2B ecommerce visitor identification playbook to turn abandoned browsing into follow-up.

One caveat: person-level identification is strongest for US B2B traffic, where match rates typically run 30–40%. Outside the US, coverage is lower and often company-level — so don’t expect the same hit rate on international storefront traffic.


Try Leadpipe free with 500 leads →


Route the identified visitors somewhere useful

Installing the snippet is step one. The value shows up when identified visitors flow into the tools your team already lives in. A few common WordPress-site setups:

  1. Real-time Slack alerts. Ping a channel the moment an ICP-fit account browses your pricing page. See Leadpipe Slack visitor alerts.
  2. CRM sync. Push named visitors into your CRM as contacts or leads — Salesforce and other CRMs sync natively or via webhook.
  3. No-code automations. Route visitors anywhere with Zapier recipes or n8n workflows.
  4. Retargeting and outreach. Feed identified accounts into retargeting audiences or a warm outbound sequence.

The single highest-leverage first play: alert a rep when a target account hits a buying-intent page. Our guide on what to do when someone visits your pricing page covers the exact follow-up motion.


How to test that it’s actually firing

Never assume an install worked. Verify it in under five minutes:

  1. Check the network request. Open your site, open browser DevTools → Network, filter for lp.js (or leadpipe), and confirm the script loads with a 200 status on multiple pages — not just the homepage.
  2. Confirm it’s on every page. Load your homepage, a blog post, and your pricing page. The request should appear on all three. If it only fires on one, your snippet isn’t truly site-wide (a common plugin-scope mistake).
  3. Do a live-visit test. Visit your own site from a work network, then check your Leadpipe dashboard for the session. Since identification depends on a verified match, use a colleague on a corporate connection for a realistic test — a home IP on a personal device often won’t match, and that’s expected behavior, not a bug.
  4. Watch the first 24–48 hours. Real identifications accumulate as live traffic flows. If the dashboard is populating and the script returns 200 site-wide, you’re done.

In one sentence: A correct WordPress install returns a 200 for the Leadpipe script on every page — verify site-wide coverage, not just the homepage.


Common WordPress install mistakes

  • Snippet only in a page-builder block. Adding it inside one Elementor/Divi section loads it on a single page. Use a header injection so it’s global.
  • Caching plugin serving a stale header. After installing, purge your cache (WP Rocket, W3 Total Cache, LiteSpeed, etc.) so visitors get the updated header.
  • Editing the parent theme. Theme updates wipe direct parent-theme edits. Use a child theme or a plugin.
  • Deferring/minifying the script into oblivion. Aggressive “optimize JavaScript” settings can break the async tag. If identification stops after enabling an optimizer, exclude the Leadpipe script from JS minification/defer.

For the broader picture of how identification fits your funnel, start with how to easily identify anonymous website visitors.


FAQ

Is there an official Leadpipe WordPress plugin?

Leadpipe installs as a single lightweight JavaScript snippet, which you add to WordPress the same way you’d add any header script — through a header-and-footer plugin (like WPCode), through Google Tag Manager, or via your child theme. The snippet approach means you’re never blocked waiting on a plugin update to match a new WordPress or PHP version, and it works identically across every WordPress host.

Will visitor identification slow down my WordPress site?

No. The script loads asynchronously, so it doesn’t block your theme, content, or Core Web Vitals from rendering. It’s a small file that fires after the page is interactive. If you run an aggressive optimization plugin, just make sure it isn’t defer-breaking the async tag — exclude it from JS minification if identification stops working.

Does it work with WooCommerce?

Yes. Install the snippet site-wide, including product, category, and cart pages. Leadpipe identifies the anonymous, pre-login visitors — for example a B2B or wholesale buyer comparing pricing who never creates an account. Your already-authenticated members don’t need identifying because you already hold their contact record.

Where do the identified visitors go?

Into your Leadpipe dashboard first, and from there anywhere you route them — Slack alerts, your CRM, or automation tools via Zapier and webhooks. Most teams start with a Slack alert on high-intent pages, then layer in CRM sync.

How do I know identification is working?

Open DevTools → Network on a few different pages and confirm the Leadpipe script returns a 200 everywhere. Then do a live visit from a corporate network and look for the session in your dashboard within 24–48 hours. See the testing section above for the full checklist.


Start identifying your WordPress traffic

WordPress makes this easy: one snippet, three install paths, and a five-minute verification. Whether you drop it in with a header-and-footer plugin, deploy it through GTM, or add it to a child theme, you’ll turn the anonymous 97% into named, deterministically-matched B2B contacts you can actually follow up with.

Pick the method that fits your stack, install it, route the results to Slack or your CRM, and watch the first identified accounts land.

Try Leadpipe free — 500 identified leads, no credit card required.