Home › Forums › Product Support Forums › Ajax Search Pro for WordPress Support › No result track
- This topic has 3 replies, 2 voices, and was last updated 10 months, 1 week ago by
Ernest Marcinko.
-
AuthorPosts
-
July 10, 2025 at 2:05 am #54885
osmankocak212
ParticipantHello, Google Analytics connections have been made and I can see the search terms. What I want is to see only the search terms that didn’t find any results. What method can I use for this? The analytics part of the plugin is weak in this area, as far as I can see.
July 10, 2025 at 8:42 am #54888Ernest Marcinko
KeymasterHi,
For that there is indeed no setting as of yet – but it should be easily doable via a small custom code snippet via the javascript API.
For that, I constructed this small snippet, which hooks into the container when the results are displayed and to sends a
no_resultsevent with the search phrase in the “phrase” property, when detects 0 results:add_action( 'wp_footer', function () { ?> <script> document.querySelectorAll(".asp_main_container").forEach((el) => { el.addEventListener("asp_results_show", (event) => { // event.detail carries the arguments const [id, instance, phrase] = event.detail; const zeroResults = document.querySelectorAll('.asp_r_' + id + '_' + instance + ' .item').length === 0; const noresContainerVisible = document.querySelectorAll('.asp_r_' + id + '_' + instance + ' .asp_nores').length > 0; if ( zeroResults || noresContainerVisible ) { // This is the GTAG event that is sent gtag('event', 'no_results', { 'phrase': phrase, }); } }); }); </script> <?php }, 9999 );Try adding this code via the Code Snippets plugin or to the functions.php file in your theme/child theme directory – make sure to have a full server back-up first for safety. For more details you can check the safe coding guidelines.
If you need any help with this, just le me know!
July 30, 2025 at 1:17 am #55063osmankocak212
ParticipantDo you have any plans to improve this area in new versions? You can see more than the first 20 searches in the analysis section, and there’s a separate section with inconclusive search terms. Your plugin has many shortcomings in this area.
July 30, 2025 at 10:05 am #55068Ernest Marcinko
KeymasterYes, definitely. Statistics is one of the oldest features due to rework.
If you have any specific suggestions you would like to see there in the future, let me know.
-
AuthorPosts
- You must be logged in to reply to this topic.