Tracking a ServiceTitan Chat Widget Without a Success Signal

Posted by: Paul Pampolino Date Posted: October 29, 2026
Back to Case Studies

Issue

The client needed successful chats reported in GA4 through Google Tag Manager. The chat runs in a cross-origin iframe from text2chat-widget.servicetitan.com, so the page can’t read anything inside it. ServiceTitan’s tracking guide covers its WebChat widget, but the site used Chat to Text, a different product with no documented events. Early scripts were built for the wrong widget, and a guessed “success” tag would have failed silently. Reading the widget’s JavaScript then showed it sends the page only ready and setFrameSizes messages, with nothing on submit.

Solution

The widget resizes its iframe when it opens and closes, and announces each resize to the page. A GTM Custom HTML tag turns those messages into one dataLayer event:

  • Widget opens (420px by 800px, or 100% on mobile): {event: 'servicetitan_chat', status: 'open'}
  • Widget closes (84px by 84px): {event: 'servicetitan_chat', status: 'closed'}

The tag checks the message origin and fires only on a real state change. GTM needs one Custom Event trigger and a Data Layer Variable status, passed to the GA4 Event tag. A trigger condition of status equals open counts opens only.

Achievement

  • Proved from the widget’s own source that submissions can’t be tracked from the page, and withdrew the guessed success tag.
  • Delivered open and close tracking as a single event with a status parameter, which needs one trigger instead of two.

Snippet/Screenshot/Link