[object Object]

← back to Wallpapercontractor

Wire /api/lead into nationalpaperhangers funnel: redirect to /find pre-filtered by mapped segment (was bare homepage), keep local lead capture

05d07effee99a81a432922bcaa38a094c960ab2e · 2026-05-31 17:13:06 -0700 · steve

Files touched

Diff

commit 05d07effee99a81a432922bcaa38a094c960ab2e
Author: steve <steve@designerwallcoverings.com>
Date:   Sun May 31 17:13:06 2026 -0700

    Wire /api/lead into nationalpaperhangers funnel: redirect to /find pre-filtered by mapped segment (was bare homepage), keep local lead capture
---
 server.js | 21 ++++++++++++++++++---
 1 file changed, 18 insertions(+), 3 deletions(-)

diff --git a/server.js b/server.js
index 8662eac..4e70e73 100644
--- a/server.js
+++ b/server.js
@@ -200,14 +200,29 @@ app.post('/api/lead', (req, res) => {
     return res.status(500).json({ error: 'Could not save your request — please email info@wallpapercontractor.com.' });
   }
 
-  // Build NPH redirect URL with utm + prefill (NPH can read these)
+  // Wire into the nationalpaperhangers funnel: land the visitor on /find (the
+  // installer-search results — the real funnel entry), pre-filtered to their
+  // project segment when it maps cleanly. NPH /find matches ?segment= against
+  // each installer's market_segments; the extra params (zip/project/sqft) ride
+  // along for attribution and are ignored as filters (so results never go empty).
+  const NPH_SEGMENT = {
+    residential: 'luxury_residential',
+    multifamily: 'luxury_residential',
+    hospitality: 'hospitality',
+    retail: 'retail',
+    // corporate + healthcare have no matching NPH segment — omit so /find shows
+    // the full installer breadth rather than an empty filtered result.
+  };
+  const seg = NPH_SEGMENT[project_type] || '';
   const params = new URLSearchParams({
     utm_source: 'wallpapercontractor',
     utm_medium: 'lead_funnel',
     utm_campaign: 'find_installer',
-    zip, project: project_type, sqft: square_footage, lead_id: lead.id,
+    utm_content: project_type,
+    project: project_type, sqft: square_footage, zip, lead_id: lead.id,
   });
-  const redirect = `https://nationalpaperhangers.com/?${params.toString()}`;
+  if (seg) params.set('segment', seg);
+  const redirect = `https://nationalpaperhangers.com/find?${params.toString()}`;
   res.json({ ok: true, redirect, lead_id: lead.id });
 });
 

← 027fb12 Add deploy runbook (Afternic delist + Kamatera deploy steps)  ·  back to Wallpapercontractor  ·  gitignore + untrack data/leads.jsonl — customer lead PII mus b8a8f85 →