Skip to content

Widget events and analytics

The widget tells the page it's on its height and each step the homeowner reaches. Use the steps to track the quote funnel in Google Tag Manager, GA4 or your own code.

View as Markdown

Messages the widget sends

The widget uses window.postMessage to talk to the page that embeds it.

typeFieldsWhen
instant-quote:heightheight: the widget's height in pixelsWhen its size changes, and before each step message.
instant-quote:stepstep, and brand: the widget IDEach time the homeowner reaches a new step.

Steps

stepMeans
addressThe widget loaded and shows the address box.
confirmThe homeowner picked a house to confirm.
resultA price range is on screen.
no_dataNo price this time: the address is outside the service area, the house can't be measured from above, the account's plan is paused, or something failed. The widget offers a visit request form instead.
bookedThe homeowner sent the form. This is the lead.

Listen in your own code

Step listenerJS
const frame = document.querySelector("iframe[data-measuredbid-widget]");

window.addEventListener("message", (e) => {
  // The widget posts to any parent, so check who sent it.
  if (e.origin !== "https://measuredbid.com" || e.source !== frame.contentWindow) return;
  if (e.data?.type !== "instant-quote:step") return;

  if (e.data.step === "result") console.log("Price shown", e.data.brand);
  if (e.data.step === "booked") console.log("Lead sent", e.data.brand);
});

Google Tag Manager and GA4

The embed code pushes { event: "iq_step", step, brand } to window.dataLayer for each step when Tag Manager is on the page. The WordPress plugin does the same and creates dataLayer if it's missing.

  1. Add variables

    In Tag Manager, create two Data Layer Variables: step and brand.

  2. Add a trigger

    Create a Custom Event trigger with the event name iq_step.

  3. Send it to GA4

    Create a GA4 Event tag on that trigger, for example named quote_step, with a step parameter set to the step variable.

  4. Mark the lead

    For a conversion, add a second trigger where step equals booked, and send a generate_lead event from it.