Home › Forums › Product Support Forums › Ajax Search Pro for WordPress Support › Site Search Tracking › Reply To: Site Search Tracking
July 3, 2019 at 4:34 pm
#23591
Keymaster
Hi Sandy,
Based on their documentation, it could be possible to connect the two plugins via the API. I would start off with something like this:
add_action('wp_footer', 'asp_custom_tracking_scpt');
function asp_custom_tracking_scpt() {
?>
<script>
jQuery(function($){
$(".asp_main_container").on("asp_search_end", function(event, id, instance, phrase) {
// Run your tracking function here
// ..based on their docs, maybe:
trackEvent('Action', 'Live Search', 'Phrase', phrase);
});
});
<script>
<?php
}
I have absolutely no idea if this does anything, but it should call the trackEvent() function (based on their API), when the search ends.