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

Site Search Tracking

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #23579
    SandySandy
    Participant

    Hi Ernest,

    Our client wants to track Site Searches, however they don’t use Google Analytics but Piwik (as they need to stay privacy-compliant),
    is it possible toget this working with Ajax Search Pro?

    https://developers.piwik.pro/en/latest/analytics/tracker_object.html#tracking-functions
    https://piwik.pro/

    Thanks in advance,
    -Sandy

    #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.

Viewing 2 posts - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.