We're Moving to a New Support Platform – Starting June 1st!

We’re excited to let you know that starting June 1st, we’ll be transitioning to a new support system that will be available directly on our product websites – Amelia, wpDataTables, and Report Builder. In fact, the new support platform is already live for Amelia and wpDataTables, and we encourage you to reach out to us there.

You'll always be able to reach us through a widget in the bottom right corner of each website, where you can ask questions, report issues, or simply get assistance.

While we still do not offer live support, a new advanced, AI-powered assistant, trained on our documentation, use cases, and real conversations with our team, is there to help with basic to intermediate questions in no time.

We're doing our best to make this transition smooth and hassle-free. After June 1st, this current support website will redirect you to the new "Contact Us" pages on our product sites.

Thanks for your continued support and trust – we’re excited to bring you an even better support experience!

Okay
  Public Ticket #3656242
GTM Tracking & Redirect After Booking
Closed

Comments

  • Ivan started the conversation

    Sharing some code which helps me to trigger a re-direct and custom event in GTM after a successful booking.

    Hope it helps someone and please let me know if you see any issues in the coding.

    Thanks!

    +++

    window.ameliaActions = {
        beforeBooking: function (success = null, error = null, data) {
    //     console.log('Before booking is created HOOK');
    //     console.log(data);
    //     console.log('------------');

    // Determine GTM event name based on Amelia Service name and redirect URL based on the name
            const name = data.componentProps.bookable.name;
            let gtmEventName = '';
            let redirectUrl = '';

            if (name === 'Coaching Call - Individual') {
                gtmEventName = 'bookingCompletedIndividual';
                redirectUrl = '/thank-you-individual';
            } else if (name === 'Coaching Call - Group') {
                gtmEventName = 'bookingCompletedGroup';
                redirectUrl = '/thank-you-group';
            }

    // Trigger custom event for GTM with debugging
            if (window.dataLayer && gtmEventName) {
                console.log(`Pushing event to GTM: ${gtmEventName}`);
                window.dataLayer.push({
                    event: gtmEventName,
                    bookingData: data
                });
            } else {
                console.error('GTM event not pushed: dataLayer or gtmEventName is missing');
            }

    // Redirect if URL is determined
            if (redirectUrl) {
    // Call success callback for the booking to be completed
                success();
                window.location.href = redirectUrl;
            } else {
    // Call success callback for the booking to be completed
                success();
            }
        }
    }

  •  1,711
    Uroš replied

    Hello Ivan,

    Thank you very much for sharing that with other people.

    Hope that this will be useful for a lot of Amelia users.

    Kind Regards, 

    Uros Jovanovic
    [email protected]

    Rate my support

    Try our FREE mapping plugin! MapSVG - easy Google maps, interactive SVG maps, and floor plans, choropleth maps and much more - https://wordpress.org/plugins/mapsvg-lite-interactive-vector-maps/

    wpDataTables: FAQ | Facebook | Twitter | InstagramFront-end and back-end demo | Docs

    Amelia: FAQ | Facebook | Twitter | InstagramAmelia demo sites | Docs | Discord Community

    You can try wpDataTables add-ons before purchasing on these sandbox sites:

    Powerful Filters | Gravity Forms Integration for wpDataTables | Formidable Forms Integration for wpDataTables | Master-Detail Tables