-
Implementing Website Search Tracking in GA4 with Google Tag Manager
Hey, I need some assistance with Google Tag Manager (GTM). Up to this point, I haven’t been able to see the customer’s search term value in Google Analytics 4 (GA4).
So here’s the deal, with the big Google-Update to GA4, we aren’t able to use special characters within search parameters anymore. This has caused some issues with TYPO3 extensions like ke_search.
The search term pops up in the URL, for instance
example.de/suche?tx_kesearch_pi[sword]=test
. But as we can’t use our (TYPO3) search parametertx_kesearch_pi1[sword]
in GA4, we’re using GTM to manage an event for our website’s search terms. (Another way would be to rename the parameter in TypoScript, but in this case, we prefer doing it in GTM).Right, let’s dive into my approach. To track the search term, I’ve set up a new tag named “GA-4 Searchterm”. The tag type is a GA4-Event and its setup is based on the GA page view tag (all pages). I’ve picked
search
for the event name as Google suggests. For the event parameter, I’ve gone withsearch_term
which is also recommended by Google. The value for this is my variable – I’ll talk about that just now.So, next up is the trigger.This is working perfectly (I’ve tested it with a few tools). Given that we have various domains in different languages, I’ve used Regex. The type is a “page view” which is triggered when the page url matches the Regex value. I’ve used the landing page name
suche|search|buscar|recherche|ricerca
for my url-pages like example.com/search.Now onto the variable. I have a hunch this is where something’s gone wrong. I’ve set it to URL and query type and for my search key, I´m using my parameter
tx_kesearch_pi1[sword]
.The final step takes place in GA4 where I’ve created a User Defined Definition.
I can see that Analytics is counting the retrieved event
search_term
but the problem is I can’t see its value i.e. Test-Search.Is there anyone who can help me out with this? Any help is greatly appreciated!
Log in to reply.