Google Analytics' Events integration in Appointments+ ?


I would like to use the Google Analytics' event for my statistics.

For example, I need to tell Google whenever someone booked a prestation, with the corresponding price. That way, google will calculate the money I'm getting with my AdWord campaign directly with the Conversion amount.

I just need to execute this javascript : ga('send', 'event', 'category', 'action', 'label', value); // value is a number.
Everytime someone book a rendez-vous, with "value" beeing the price of the prestation the user just booked.

Any ideas ? I think this would be a great enhancement in the plugin, allowing people to know exactly inside GA, how much they are getting from the Appointments+ plugin.

Best Regards,
Quentin HELLO

  • Jack Kitterhing

    Hi there @quentin_hello,

    Hope you're well today and thanks for the additional information! :slight_smile:

    I can't find a filter to execute the code outside of modifying the core code for this specific purpose.

    But as a workaround, how about if you have that Javascript on a page and we redirect to that page upon appointment booking? You can then use this code for redirecting to a page of your choice.

    function app_redirect( $script ){
        return str_replace("window.location.href=app_location()", "window.location.href=''", $script);
    add_filter( 'app_footer_scripts', 'app_redirect' );

    Where is the complete URL of the page you want to redirect to upon booking.

    You can then add that in your themes functions.php


    Kind Regards

  • Vinod Dalvi

    Hi @quentin_hello,

    Try using any of the following code to retrieve the appointment data submitted.

    function custom_app_post_confirmation_status( $status, $price, $service, $worker, $user_id ){
    	// Process the submitted data as parameters here
    add_filter( 'app_post_confirmation_status', 'custom_app_post_confirmation_status', 10, 5 );


    function custom_new_appointment( $app_id ){
    		global $wpdb;
    		$app = wp_cache_get( 'app_'. $app_id );
    		if ( false === $app ) {
    			$app = $wpdb->get_row( $wpdb->prepare("SELECT * FROM $wpdb->prefix.app_appointments WHERE ID=%d", $app_id) );
    			wp_cache_set( 'app_'. $app_id, $app );
    		// Process the submitted data retrieved in  $app variable here
    add_action( 'app_new_appointment', 'custom_new_appointment');

    Vinod Dalvi

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.