2

I have a search feature on my website. I am sending the textbox value to a controller using Ajax and reading the response. I want to track the text box value in Google Analytics 4. I have created a custom event but confused about what will be my matching condition (parameter name, operator and value)?

enter image description here

window.gtag('event','search_keyword',{
  search_term_input : $('#txt-search').val(),
  country_code : 'UK'
});

The request is reaching GA4 and the event is visible in the Real-time tracking dashboard. I have created a custom dimension for the search_keyword event and when generating the report the search term is not available. The report displays "not set".

enter image description here

1 Answer 1

1

Not sure if this will work as I don't have a setup to test it on atm.

In the Web Data Stream Settings, try adding the cd parameter name in the GA4 Site Search settings in the Additional Query Parameters field enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.