• Resolved michael.adis

    (@michaeladis)


    Hi

    Im writing regarding the confirmation for the bookings. I have a problem when someone makes a reservation the website reloads and goes back to Home. Im using one page website (not optimal but that is the case for now). And I would like to have the confirmations / rejections to popup instead so that it is clear when making a booking that it has been done.

    Regarding google analytics conversion monitoring I needs a way to inform analytics that someone just made it to bookings and or made a reservation, for conversion monitoring.

    I would be very happy if i could get help to fix both issues.

    page is: https://www.capriri.com/
    thanks,

    br
    Michael

    https://www.ads-software.com/plugins/restaurant-reservations/

Viewing 9 replies - 1 through 9 (of 9 total)
  • Hi Michael,

    Both of these things will require writing some custom PHP code. You can alter the URL the form submits to by hooking into the rtb-setting-booking-page hook available here.

    You could use that to add a #anything URL hash. You’d then need to set up your one-page site so that the section with the reservations has a name anchor or ID matching the anything value. That will get the browser to jump to the booking form when the page is reloaded.

    The Google Analytics stuff is probably easiest just to enqueue some custom JavaScript which triggers the event when a booking is successfully submitted. You can use the rtb_insert_booking hook here to do that.

    Thread Starter michael.adis

    (@michaeladis)

    Hi

    I dont seem to know how to make it work, could u please pinpoint where i should add #booking.

    regarding analytics, ill give it a try to put a pixel tracker and monitor it.

    You’re right, now that I think about it the booking-page setting only refers to the page ID. You couldn’t hook in and add the #booking there.

    In that case, it’s probably better to just enqueue a small snippet of JavaScript with the rtb_insert_booking hook. This JavaScript could simply scroll to the booking form on the page once its loaded.

    Hi NateWr,
    i think the best solution for all users will be to add ajax support.

    Hi
    I’m also interested on being able to add the google analytics goal track as we do with CF7
    would it be something you would consider adding in future updates?

    Currently I’m manually modifying the link but I have to come back and change it again every time I update.

    Otherwise is there a way to add it from the functions.php?

    Thanks

    David

    Hi David,

    What is it that you want to accomplish? As I mentioned above, the rtb_insert_booking hook can be used to enqueue a snippet of JavaScript to send an event back to Google Analytics. The code would look something like this:

    add_action( 'rtb_insert_booking', 'davidiborra_add_google_analytics_code' );
    function davidiborra_add_google_analytics_code( $booking ) {
    	wp_enqueue_script( 'davidiborra-conversion-tracking', PATH_TO_THE_JAVASCRIPT_FILE );
    }

    Hi Nate,

    sorry for not replying earlier forgot to check the notifications for this thread. I don’t need to enqueue an script but to trigger the Analytics by Yoast script to send a goal completion

    This is what i’m currently doing:
    I’m modifying this file
    restaurant-reservations/includes/template-functions.php
    here on line 73
    <form method="POST" onsubmit="__gaTracker('send', 'pageview', '/goals/reservations');" action="<?php echo esc_attr( $booking_page ); ?>">

    I’m using Analytics by Yoast plugin so instead of the standard GA hook I use __gaTracker
    I’d appreciate your help to achieve this without tampering the plugins functions and be able to update without loosing the goal tracker.

    you can see it working here: https://www.praderarestaurant.com/reservation/

    Thanks in advance for your help

    Thanks

    David

    Hi David,

    The booking form may return an error message, so the code you posted will submit the goal completion even if a booking is not valid, returns an error and therefore isn’t completed. If a user takes several tries to make a booking it may record multiple goal completions.

    Your onsubmit value is just JavaScript. If you take this:

    __gaTracker('send', 'pageview', '/goals/reservations');

    And chuck it into a JavaScript file and then use the code I sent above, it will be loaded only after a successful booking.

    Thanks Nate,

    Much better now thanks for helping me on this!

    Cheers

    David

Viewing 9 replies - 1 through 9 (of 9 total)
  • The topic ‘Booking confirmation on the page – google Analytics conversion’ is closed to new replies.