Okay
  Public Ticket #2711272
Question regarding the finish of an appointment
Closed

Comments

  •  1
    Arne De Belser started the conversation

    Hello,

    I have some questions regarding when you finish booking an appointment.

    My SEO team wants to track thank you page redirects. But right now, when someone finishes an appointment, they first have to click a button before they actually go to the redirect page. We found out that a lot of people don't click this button, so we lose a lot of analytics.

    Is there a way to automatically forward users to the thank you page after succesfull appointment registration?

  • [deleted] replied

    Hello Arne De Belser ,

    Apologies for replying a bit later, we don't work on weekends.

    There are some JS hooks in Amelia, that are triggered depending on the view:

    window.beforeAddToCalendarLoaded()
    window.beforeBookingLoaded()
    window.beforeSearchLoaded()
    window.beforeSearchFiltered()
    window.afterSearchFiltered()
    window.beforeConfirmedBooking()
    window.beforeCatalogLoaded()
    window.afterSelectCatalogCategory(object_category)
    window.beforeCatalogCategoryLoaded(object_category)
    window.beforeCatalogServiceLoaded(object_category, object_service)
    window.afterSearchActivateService(object_appointment, object_serviceActive)
    window.afterSearchGoToSecondStep(object_appointment, object_serviceActive)
    window.afterBookingSelectDateAndTime(object_appointment, object_serviceId, object_providerId, object_locationId)
    window.afterBookingSelectService(object_appointment, object_serviceId, object_providerId, object_locationId)
    window.beforeConfirmBookingLoaded(object_appointment, object_service, object_provider, object_location)
    window.afterConfirmBooking(object_appointment, object_service, object_provider, object_location)

     

    You can use the hook, for example, beforeConfirmedBooking, that will be triggered when your customers confirm booking, to redirect them to another page. You will of course set the redirect URL that you want in the script:

    <script>
    window.beforeConfirmedBooking = function()
    {
    window.location.href = "https://www.google.com";
    };
    </script>

    And you need to just place this script on the page where you have your Amelia shortode, if that could help you achieve what you need. 

    If you have any other questions or concerns feel free to open a new ticket and we will gladly help out.

  •  1
    Arne De Belser replied

    Hello there,

    Is there a way to capture the current "Service" or "form" your working on. You see each of our services redirects to another thank you page.

    Maybe something like this;

    <script>
    window.beforeConfirmedBooking = function(event)
    {
    if(event.id === 400) {
    window.location.href = "https://www.google.com";
    }
    };
    </script>

    Do you maybe have some kind of documentation for developers?

  • [deleted] replied

    Hello Arne,

    We don't have developers' documentation, unfortunately.

    There are  some JS hooks, that are triggered depending on the view:

    window.beforeAddToCalendarLoaded()
    window.beforeBookingLoaded()
    window.beforeSearchLoaded()
    window.beforeSearchFiltered()
    window.afterSearchFiltered()
    window.beforeConfirmedBooking()
    window.beforeCatalogLoaded()
    window.afterSelectCatalogCategory(object_category)
    window.beforeCatalogCategoryLoaded(object_category)
    window.beforeCatalogServiceLoaded(object_category, object_service)
    window.afterSearchActivateService(object_appointment, object_serviceActive)
    window.afterSearchGoToSecondStep(object_appointment, object_serviceActive)
    window.afterBookingSelectDateAndTime(object_appointment, object_serviceId, object_providerId, object_locationId)
    window.afterBookingSelectService(object_appointment, object_serviceId, object_providerId, object_locationId)
    window.beforeConfirmBookingLoaded(object_appointment, object_service, object_provider, object_location)
    window.afterConfirmBooking(object_appointment, object_service, object_provider, object_location)

     

    And there are some WP hooks in Amelia

    This should be added to  "wp-content/mu-plugins/functions.php"

    <?php
    function amelia_booking_added_hook($reservation, $bookings, $container) {
    }
    add_action('AmeliaBookingAdded', 'amelia_booking_added_hook', 10, 3);
    function amelia_booking_time_updated_hook($reservation, $bookings, $container) {
    }
    add_action('AmeliaBookingTimeUpdated', 'amelia_booking_time_updated_hook', 10, 3);
    function amelia_booking_status_updated_hook($reservation, $bookings, $container) {
    }
    add_action('AmeliaBookingStatusUpdated', 'amelia_booking_status_updated_hook', 10, 3);
    function amelia_booking_canceled_hook($reservation, $bookings, $container) {
    }
    add_action('AmeliaBookingCanceled', 'amelia_booking_canceled_hook', 10, 3);
    ?>

    So, these functions will be triggered after these actions: booking, cancelling, time update, status update

    $reservation has data about the appointment (startTime, endTime...)

    $bookings contains data about the bookings that started the action (from the front-end there will be one booking, and in the back-end there can be more, if a group appointment is created)

    So, you can check if you can use one of these to achieve what you need.

    If you have any other questions or concerns feel free to open a new ticket and we will gladly help out.