B2B Web Tracking Forensic Audit and Remediation
The client had a history of tracking problems across a shared GTM implementation, including Microsoft lead events that appeared to fire in Tag Manager while conversions were missing in the ad platform. The audit established production version 464 as a fixed baseline and treated configured state, Preview behavior, browser transmission and platform receipt as separate evidence layers. Inspection of the Microsoft tags exposed the root cause: uet_report_conversion() was declared but never invoked. The tags were rewritten to directly enqueue submit_lead_form and deepfake_era_download, then verified through real bat.bing.com requests returning HTTP 204 and through Microsoft UET Insights. The same audit found that the central HubSpot listener generated hubspot-form-success from pre-persistence onFormSubmit. A temporary debug listener proved the post-submit payload on two separate B2B forms, after which the central listener was rewritten around onFormSubmitted while retaining the existing dataLayer contract consumed by Google, Meta, LinkedIn, Microsoft and StackAdapt.
The audit proved a case where GTM reported a Microsoft conversion tag as fired even though the conversion function was never invoked and no custom event was being sent.
Role: Primary technical auditor and remediation implementer
The Problem
The client had a history of tracking reliability problems, and Microsoft lead tracking was reported as failing even while leads, MQLs and SQLs were present in Salesforce. The account was considered strategically important, so inaccurate conversion signals directly undermined reporting confidence and paid-media optimization.
The Microsoft GTM conversion tags could report as fired while never actually transmitting their custom events because uet_report_conversion() was declared but not invoked. Separately, the central B2B Hubspot Form Listener DC labeled an event hubspot-form-success while listening to HubSpot's pre-persistence onFormSubmit, creating a semantic risk that downstream conversion tags could fire before confirmed successful persistence.
The implementation lived inside a large shared GTM container spanning multiple the client properties and subdomains, with significant legacy logic and multiple ad-platform tags consuming a common HubSpot event. Correctness therefore required separating production configuration, workspace configuration, browser runtime behavior and platform receipt instead of trusting GTM's 'Tag Fired' state.
Approach & Architecture
Established GTM production version 464 as the immutable audit baseline and explicitly separated Published/Production, Current Workspace and Observed Behavior. Diagnosed both Microsoft custom-event tags, replaced the non-invoked function pattern with direct window.uetq.push() calls, and validated the resulting browser requests to Microsoft before publication. Created the missing Microsoft conversion goal for the Deepfake report and confirmed both custom events appeared in Microsoft UET Insights. Then instrumented HubSpot with a temporary diagnostic listener, proved onFormSubmitted behavior on both the main contact form and the Deepfake report form, and rewrote the central listener to use confirmed post-submission data while preserving existing downstream dataLayer event names.
HubSpot forms on identity.client.com emit hsFormCallback messages. B2B Hubspot Form Listener DC converts successful onFormSubmitted callbacks into the stable dataLayer contract hubspot-form-data plus hubspot-form-success, carrying form GUID, email and phone. Platform-specific GTM tags consume hubspot-form-success; Microsoft tags enqueue submit_lead_form or deepfake_era_download into UET, which sends requests to bat.bing.com/action/0. Microsoft conversion goals then match the UET event action names.
Key Decisions & Trade-offs
Hardest Part
The hardest diagnostic was proving that Microsoft tracking was failing despite GTM reporting the conversion tag as fired. Inspection of the tag code showed that it only defined uet_report_conversion() and never called it; replacing that with a direct UET queue push and then finding ea=submit_lead_form / ea=deepfake_era_download in actual bat.bing.com requests with HTTP 204 converted a suspected configuration problem into a proven root cause.
Technical Detail
The B2B form event contract is centered on hubspot-form-data and hubspot-form-success. hubspot-form-success carries hs-form-guid, hs-form-email and hs-form-phone; the remediated listener reconstructs the prior array-style hs-formData from HubSpot's submissionValues object so existing downstream consumers remain compatible.
Client-side browser tracking inside the shared www.client.com Google Tag Manager container GTM-XXXXXXX, covering identity.client.com and other the client properties. No new server-side infrastructure was deployed in this chat.
Used exported GTM production configuration, Quick Preview, Tag Assistant session JSON, Chrome DevTools Network inspection, Microsoft Advertising UET Insights, conversion-goal configuration and form-specific regression tests. The audit standard was configuration -> trigger -> browser execution -> network transmission -> platform receipt, with attribution treated as a separate layer. Final Tag Assistant evidence shows B2B Hubspot Form Listener DC running on onFormSubmitted.
Code
function uet_report_conversion() { window.uetq = window.uetq || []; window.uetq.push('event', 'submit_lead_form', {});
}
window.uetq = window.uetq || [];
window.uetq.push("event", "submit_lead_form", {});
window.uetq = window.uetq || [];
window.uetq.push("event", "deepfake_era_download", {});
window.addEventListener("message", function(event) { if ( event.data && event.data.type === "hsFormCallback" && event.data.eventName === "onFormSubmitted" ) { window.dataLayer.push({ event: "client-hubspot-submitted-debug", hubspot_event_data: event.data }); }
});
window.addEventListener("message", function(event) { if (!event.data || event.data.type !== "hsFormCallback" || event.data.eventName !== "onFormSubmitted") return; var values = event.data.data && event.data.data.submissionValues ? event.data.data.submissionValues : {}; var formData = []; for (var key in values) { if (Object.prototype.hasOwnProperty.call(values, key)) formData.push({ name: key, value: values[key] }); } var email = values.email || ""; var phone = values.phone || ""; var formGuid = event.data.id || (event.data.data && event.data.data.formGuid) || ""; window.dataLayer = window.dataLayer || []; window.dataLayer.push({ event: "hubspot-form-data", "hs-form-guid": formGuid, "hs-formData": formData }); if (email && phone) { window.dataLayer.push({ event: "hubspot-form-success", "hs-form-guid": formGuid, "hs-form-email": email, "hs-form-phone": phone }); }
});
ChatGPT was used as an active audit copilot: parsing exported GTM and Tag Assistant JSON, comparing production and workspace behavior, identifying the uninvoked Microsoft conversion function, interpreting browser Network traces, generating controlled diagnostic code, designing the onFormSubmitted migration, and sequencing regression tests so each conclusion was tied to observable evidence.
Measured Results
The audit converted a vague 'Microsoft tracking is broken' report into a proven code-level root cause and validated browser-to-Microsoft transmission for both submit_lead_form and deepfake_era_download. Microsoft UET Insights then showed both event names, and the missing Deepfake conversion goal was created. The central HubSpot listener was also successfully regression-tested in Quick Preview using onFormSubmitted; the chat does not contain evidence that the final combined GTM changes were published to production.
| Metric | Value | Before | Source |
|---|---|---|---|
| GTM production tags Container scale at the production baseline, not a project outcome. | 207 | n/a | Google Tag Manager version 464 UI |
| GTM production triggers Container scale at the production baseline, not a project outcome. | 265 | n/a | Google Tag Manager version 464 UI |
| GTM production variables Container scale at the production baseline, not a project outcome. | 54 | n/a | Google Tag Manager version 464 UI |
| Microsoft submit_lead_form events visible in UET Insights Observed platform event count after QA activity; this is not a count of attributed business conversions. | 4 | n/a | Microsoft Advertising UET Insights |
| Microsoft deepfake_era_download events visible in UET Insights Observed platform event count after QA activity; this is not a count of attributed business conversions. | 1 | n/a | Microsoft Advertising UET Insights |
Every figure above was recorded during the work itself. Where no number was measured, none is claimed.