This website uses cookies to personalize your experience. By using this website you agree to our cookie policy.

Reply To: Site Search Tracking

#23591
Ernest MarcinkoErnest Marcinko
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.