Home › Forums › Product Support Forums › Ajax Search Pro for WordPress Support › GA4 Integration Question
- This topic has 9 replies, 2 voices, and was last updated 11 months, 2 weeks ago by
Ernest Marcinko.
-
AuthorPosts
-
June 17, 2025 at 8:27 pm #54440
danielschwindt_zjjc
ParticipantI think I’ve pretty much got it all integration (GA4 and ASP) but one thing is confusing me on how it works:
Here is the video version in case my typed message makes no sense: https://somup.com/cT1bYZLTra
Basically I am getting data in my GA4 events for the search phrase that I didn’t configure, and I’m wondering where it is coming from.
For example, if I type open my website and type “diagnostic” into my search bar, then go to my GA4 realtime events, I’ll see two entries:
Phrase: diagnostic
diagnosticI know where the second line is coming from, since I have the “Live search end event tracking” set to only contain “{phrase}” in the label. So far so good. But where is the “Phrase: diagnostic” one coming from? None of my plugin settings are configured to display “Phrase: {phrase}”.
I notice that “Live search start event tracking” has that in its settings, but I have that one disabled on the toggle. Perhaps I have an issue where, even though that toggle is disabled, that event data is still being triggered somehow, such that each time I enter a search, I get the event I want (just the phrase) and then the one I don’t, “Phrase: {phrase}”?
June 17, 2025 at 8:46 pm #54441danielschwindt_zjjc
ParticipantI’ll also add that I’m getting those “Phrase: {phrase}” entries for every additional key that is pressed for a query. So if someone types “pt2448” I will get a whole list of events in GA4 for “pt” and “pt2” and then “pt24” “pt244” and so on. Definitely would like to turn that off if possible.
-
This reply was modified 11 months, 3 weeks ago by
danielschwindt_zjjc.
June 18, 2025 at 7:22 am #54444Ernest Marcinko
KeymasterHi,
Thanks for the video, that actually helped a lot.
So in the video you are looking at an event called search_term. However that event is not coming from Ajax Search Pro. As you scrolled through the options on the back-end, the event names were the default: focus, search_start, search_end, magnifier etc..
The event search_term seems to be a core GA4 analytics event parameter. I suspect it is triggered when you view the search results page, when the enhanced measurments are active.
My guess is, that you should be able to test that by visiting the search results page with a couple of different phrases, they should start showing up under the search_terms event.June 18, 2025 at 12:30 pm #54445danielschwindt_zjjc
ParticipantHey Ernest, please take a look at this one and hopefully it will clarify: https://somup.com/cT1FlTLOdj
It does give you a view in the GTM preview/debug window as to which asp_events are triggering and whether or not that is what should be happening. As I mention in the video, I know it isn’t in the scope of your support to setup my GA4/GTM but I’m wondering if the search_start event is being triggered incorrectly even though I have it disabled in my settings.
June 18, 2025 at 12:42 pm #54446Ernest Marcinko
KeymasterOh, I’m sorry, I was confused and thought that was due to the results page.
You are right, that shouldn’t be triggered. I quickly checked, and there seems to be a type coercion issue within the core script, I can replicate this.
Long story short, the script checks if the option is disabled, and the option is sent as either a 0 (if disabled) or 1 (if enabled). However by mistake it’s converted to a string, therefore instead of 0 or 1 the value is “0” or “1”. And in javascript deals with that in a funny way, as 0 is coerced to a boolean false, but “0” is a boolean true – therefore it thinks the option is enabled.
I will get back to you in an hour or so, I think I can patch this real quick and send you a beta copy to test.
June 18, 2025 at 12:49 pm #54447danielschwindt_zjjc
ParticipantAwesome! Thanks, great to hear. Not a huge rush but glad to have a fix when ready.
June 18, 2025 at 1:05 pm #54448Ernest Marcinko
KeymasterYou cannot access this content.
June 18, 2025 at 3:48 pm #54450danielschwindt_zjjc
ParticipantYou got it, all fixed, only the events I toggled were fired.
June 18, 2025 at 5:57 pm #54451danielschwindt_zjjc
ParticipantSo can I just leave this beta installed and then it’ll update as usual when the next version comes?
June 19, 2025 at 9:59 am #54452Ernest Marcinko
KeymasterPerfect, thank you for the feedback.
Yes, keep this one installed, I have already merged this bugfix to the upcoming release.
-
This reply was modified 11 months, 3 weeks ago by
-
AuthorPosts
- You must be logged in to reply to this topic.