1. Home
  2. Automations
  3. Visitor Inactivity Trigger

Visitor Inactivity Trigger

  • Purpose: Detects when someone lands on your site but doesn’t interact (no chat, form, etc.) within a short timeout, then feeds that session into the automation engine for follow-up actions or internal alerts.
  • How it works:
    1. Drop <script src=”https://go.launchsms.com/js/visitor-inactivity.js” data-visitor-inactivity data-api-key=”{insert_launchsms_api_key}”> on your page (optionally add data-timeout-secondsdata-departmentdata-widget-session-id).
        1. data-timeout-seconds: controls how long (in seconds) the script waits after the last user interaction before it fires the inactivity event. You can tune it per page depending on how quickly you want to consider someone “inactive” (default is 20 seconds).
        2. data-department: an optional label that gets included in the payload under department. It’s useful to route the resulting automation run to a specific team/queue or just log which part of the site triggered the event.

        3. data-widget-session-id: if you already generate a widget-level session ID elsewhere, pass it here so the inactivity event shares the same widget_session_id as other widget analytics. That keeps the data grouped cohesively in your analytics tables.

    2. The script builds a session ID, captures page/UTM/referrer info, and restarts a timer on user interactions (click, scroll, keydown, etc.).
    3. When the timer expires, it POSTs the payload to /api/analytics/track-visitor-inactivity.
  • Server processing:
    1. The API validates the widget (chat) key, logs analytic data through FormAnalyticsService, and ensures every visitor gets a Customer (using first_session_id, creating a placeholder record when needed).
    2. It emits VisitorInactivityDetected, which filters automations by optional “landing page contains” or “traffic source contains” rules before queuing steps.
  • Automation plumbing:
    • “visitor_inactivity” is now an allowed trigger type in the builder.
    • The UI exposes inputs for matching URL fragments/traffic sources.
    • Automations score the event the same way as other triggers, enabling delays, notifications, tag updates, and (once a real email/phone is collected) outbound SMS/email steps via the existing runner.
  • Limitations: Until the visitor provides real contact info (chat submission, form, etc.), SMS/email actions will fail because there’s no actual email or phone; use this trigger primarily for internal notifications, tagging, or chaining into workflows that wait for data.
Updated on December 9, 2025
Was this article helpful?

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.