Skip to main content

OnSched GTM Event Listener

Track OnSched appointment booking interactions in GTM. Monitor booking steps and confirmed appointments with onsched_action variable.

onschedschedulingappointmentsbookinggtmga4healthcareservices

Event fired

onsched_interactions

Key variable

onsched_action

OnSched

Overview

OnSched is an appointment booking platform used in healthcare, fitness, professional services, and other sectors. This listener tracks the multi-step booking process and confirmed appointments.

Event fired: onsched_interactions Variable: onsched_action

Tracked Events

onsched_actionDescription
booking startedBooking flow initiated
service selectedUser picks service type
provider selectedUser picks staff member
time slot selectedDate/time chosen
personal info submittedContact details entered
booking confirmedAppointment booked
booking cancelledCancellation processed
booking rescheduledAppointment moved

Installation

html
<!-- GTM Custom HTML Tag: OnSched Listener -->
<script>
(function() {
  function onschedPush(action, extra) {
    window.dataLayer = window.dataLayer || [];
    window.dataLayer.push(Object.assign({
      'event': 'onsched_interactions',
      'onsched_action': action
    }, extra || {}));
  }

  function isOnSchedMessage(e) {
    return e.data && e.data.source === 'onsched';
  }

  window.addEventListener('message', function(e) {
    if (!isOnSchedMessage(e)) return;
    var data = e.data;
    
    if (data.type === 'serviceSelected') {
      onschedPush('service selected', { serviceId: data.serviceId, serviceName: data.serviceName });
    } else if (data.type === 'resourceSelected') {
      onschedPush('provider selected', { resourceId: data.resourceId });
    } else if (data.type === 'timeSelected') {
      onschedPush('time slot selected', { selectedTime: data.startDateTime });
    } else if (data.type === 'appointmentBooked') {
      onschedPush('booking confirmed', {
        appointmentId: data.appointmentId,
        serviceId: data.serviceId,
        appointmentTime: data.startDateTime
      });
    } else if (data.type === 'appointmentCancelled') {
      onschedPush('booking cancelled', { appointmentId: data.appointmentId });
    }
  });
})();
</script>

Data Layer Output

json
{
  "event": "onsched_interactions",
  "onsched_action": "booking confirmed",
  "appointmentId": "appt_abc123",
  "serviceId": "service_001",
  "appointmentTime": "2024-02-20T09:00:00Z"
}

Trigger Configuration

All Events

Trigger Type: Custom Event Event Name: onsched_interactions

Conversion Only

Condition: DLV – OnSched Action | equals | booking confirmed

GA4 Mapping

GA4 EventTriggerParameters
book_appointmentbooking confirmedappointment_id, service
select_contenttime slot selectedcontent_type: "time_slot"

Related Listeners

More Scheduling