How can I track search pages terms with Zaraz?

I want to track search terms for the search pages with Zaraz Google Analytics 4 tool. My search query parameter is s (e.g. /?s=Cloudflare). Here’s my settings to achieve that-

Is that all? Not getting search terms with that. What can I do?

Hey there, thanks for reaching out about this.

As an immediate fix for your usecase, you could update your search trigger to instead check for whether {{ }} contains s=.
Your action then needs to send the value of query, {{ }}, as a custom field called search_term.

Longterm, we should update the list of available fields to include the search term field by default (thanks for flagging); and try to make integration with GA4’s site search feature more intuitive.

Hope that helps

Thanks for the great reply!

Action search_term field with {{ }} is working perfect.

But triggers working with my previous entries:

Match rule {{ }} Contains s


Just to clarify, {{ }} on a page url like “” will return ?cheese=brie&bread=rye, which also contains s hence you might benefit from using s= as a match string value instead. Maybe even ?s= if you’re sure that it will always be the first query key in the url.

Glad it’s working for you now either way

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.