Search code examples
google-analyticsgoogle-analytics-apigoogle-analytics-4

register and view events with action in GA4


I have a search textbox in my site and when a user stops typing I register an event (search, txt value), in Universal Analytics I was calling it like this:

ga('send', 'event', 'search', txtValue)

in GA4 I tried doing this:

gtag('event', 'search', { action: txtValue });

and the event gets registered, but nowhere in the GA4 reporting can I find how to see the registered events with action table, something like this:

(event = 'search')
action    | count
txt val 1 | 32
txt val 2 | 5
txt val 3 | 1

in UA I wold just go to Events -> click on 'search' event -> and select 'action' for 2nd dimension,

how do I get this report now ? or should I register the event in some other way ?


Solution

  • Well, you need to make custom dimensions for your event parameters to become available. Similarly to GA UA:

    Admin -> Custom Definitions -> Create custom dimension

    Now just make a CD for your action property.

    Good, now go to the Explore NOT Reports. Reports are now pretty much useless. In Explore, make a new exploration, add your new action custom dimension there as a dimension. Also add the event name as a dimension. Add something like sessions as a metric.

    Now drag and drop the items you've added into the tab setting column and you should be able to access your data now. It's a clumsy interface for sure, but it works. You can as well add a filter there to only include the search events in case you want to reuse that event property in other events.

    Note! that google has now introduced this all new and shiny cardinality limitation on your dimensions. So if you get over 500 unique search values in that custom dimensions, well, read this: https://support.google.com/analytics/answer/12226705?hl=en

    UA was too good to be free. They "fixed" it in GA4 :)