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
});
}
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
Still nope π
I put my “UA-” code for the gtag value and the behavior is still the same as before.
Anything else I could try?