English (United Kingdom)
Knowledge Base  >  Vik Booking  >  For Developers  >  Custom Tracking

do_action( 'vikbooking_before_save_tracking_information', object $trk_info_record, int $id_tracking, VikBookingTracker $trk )

Fires before storing a tracking information record for a website visitor.


Description

Plugins can use this filter to execute specific and custom tracking functions at runtime.

It is possible to append to the document custom tracking snippets to interface with your preferred tracking/analytics system.


Parameters

$trk_info_record

(object)  The current tracking record being stored onto the system.

$id_tracking

(int)  The ID of the tracking record being stored onto the system.

$trk

(object)  The instance of the VikBookingTracker object that handles the whole tracking operation.

This is how the hook will fire. The information contained inside the various objects can be used to transmit data to your preferred tracking system in the format they require it.


/**
 * Triggers an action to let plugins perform any custom tracking operation when VikBooking does its own.
 * 
 * @param   object  $trk_info_record  the tracking record being stored with all the information.
 * @param   int     $id_tracking      the ID of the current tracking record.
 * @param   object  $trk              an instance of the VikBookingTracker object to access any property.
 */
add_action('vikbooking_before_save_tracking_information', function($trk_info_record, $id_tracking, $trk)
{
    // perform any kind of custom action, by adding for example a JavaScript snippet
    // to the document through the WordPress native functions.
}, 10, 3);

This hook will be fired on any page of the front-end booking process with different information depending on the step the visitor is on. For example, the search results page will trigger this hook after the guests have selected the stay dates. The hook will fire also after selecting an available room and after selecting an available rate plan.

Whenever a booking is confirmed (paid) via front-end by the guest, the system will trigger the apposite hook for the booking conversion. This way, the tracking information will be automatically assigned to the new customer record and the reservation generated to update metrics and statistics.

do_action( 'vikbooking_booking_conversion_tracking', array $booking, object $trk_info_record )

Fires when a previously tracked website visitor confirms a booking, hence generates a booking conversion.


Description

Plugins can use this filter to execute specific and custom conversion/tracking functions at runtime.

It is possible to append to the document custom conversion snippets to interface with your preferred tracking/analytics system.


Parameters

$booking

(array)  The reservation record array for the conversion.

$trk_info_record

(object)  The last tracking record stored for this visitor.

This is how the hook will fire. The information contained inside the various arguments can be used to transmit data to your preferred conversion/tracking system in the format they require it.


/**
 * Triggers an action to let plugins perform any custom booking conversion operation.
 * 
 * @param   array   $booking          the reservarion record that generated the conversion.
 * @param   object  $trk_info_record  the tracking record being stored with all the information.
 */
add_action('vikbooking_booking_conversion_tracking', function($booking, $trk_info_record)
{
    // perform any kind of custom action, by adding for example a JavaScript snippet
    // to the document through the WordPress native functions. You can access any booking
    // information from the $booking array (i.e. the booking total amount).
}, 10, 3);
Last Update: 2023-06-13
Helpful?
100% of people found this helpful.
This site uses cookies. By continuing to browse you accept their use. Further information