• Hello! I seem to be having an issue with getting the search terms showing up properly in Google Analytics. I’ve set it up according to the guide and setting the parameter to s in the View Settings.

    And whilst I can see some searches in the search reports as well as the events page, I do not seem to be getting any of the ajax-search: terms to appear in my reports, only the search terms where someone specifically visited the search results page.

    All search terms do appear on the events page, but the ajax ones are not shown in the Site Search page.

    • This topic was modified 5 years, 6 months ago by timmyfox.

    The page I need help with: [log in to see the link]

Viewing 6 replies - 1 through 6 (of 6 total)
  • Thread Starter timmyfox

    (@timmyfox)

    Also to add an example with steps to reproduce:

    1. Search “test1” and click to view all results
    2. Search “test2” but don’t click to view all results, instead click away or on one of the results directly.

    After waiting for GA to catch up, I can see both “test1” and “test2” shown on the Events page under “Event labels”

    But if I go to the Site Search page, only “test1” will show up in the list of search terms. I do not see either “test2” nor “ajax-search: test2” in this list.

    • This reply was modified 5 years, 6 months ago by timmyfox.
    • This reply was modified 5 years, 6 months ago by timmyfox.
    • This reply was modified 5 years, 6 months ago by timmyfox.
    • This reply was modified 5 years, 6 months ago by timmyfox.
    Plugin Author ILLID

    (@mihail-barinov)

    Hi,

    Looks like the problem here can be in the Tag Manager.

    Please try the following: open advanced-woo-search/assets/js/common.js file, find lines

    if ( typeof gtag !== 'undefined' ) {
                                gtag('event', 'AWS search', {
                                    'event_label': label,
                                    'event_category': 'AWS Search Term'
                                });
                            }

    and replace with

    if ( typeof gtag !== 'undefined' ) {
                                gtag('event', 'AWS search', {
                                    'event_label': label,
                                    'event_category': 'AWS Search Term'
                                });
                                window.dataLayer = window.dataLayer || [];
                                window.dataLayer.push({
                                    'event' : 'search',
                                    'searchTerm' : 'ajax-search:' + label
                                });
                            }
    Thread Starter timmyfox

    (@timmyfox)

    Hm, doesn’t seem to work still.
    I replaced the code and made sure to clear my caches and tried again, first searching one thing and clicking on a product and then from there searching a different term and going straight to the search results. After ~5-10 minutes I see the latter search term, but not the former, under site search.

    Plugin Author ILLID

    (@mihail-barinov)

    Ok, than one more thing. Please try to replace

    if ( typeof gtag !== 'undefined' ) {
                                gtag('event', 'AWS search', {
                                    'event_label': label,
                                    'event_category': 'AWS Search Term'
                                });
                            }

    with

    if ( typeof gtag !== 'undefined' ) {
                                gtag('event', 'AWS search', {
                                    'event_label': label,
                                    'event_category': 'AWS Search Term'
                                });
     gtag('event', 'page_view', {
                                    page_title: 'AWS search',
                                    page_path: '/?s=' + encodeURIComponent( 'ajax-search:' + label ),
                                    send_to: '<GA_MEASUREMENT_ID>'
                                })
                            }

    please replace <GA_MEASUREMENT_ID> with the proper gtag value

    Thread Starter timmyfox

    (@timmyfox)

    Still nope πŸ™

    I put my “UA-” code for the gtag value and the behavior is still the same as before.

    Thread Starter timmyfox

    (@timmyfox)

    Anything else I could try?

Viewing 6 replies - 1 through 6 (of 6 total)

The topic ‘Google analytics site search issue’ is closed to new replies.