Learn business growth with Google Analytics 4 Forums Google Analytics 4 Exploring the Transition from Google Universal Analytics to GA4 Event Tracking

  • Exploring the Transition from Google Universal Analytics to GA4 Event Tracking

    Posted by Ethan on 20 March 2023 at 4:58 pm

    We’re currently using the Measurement Protocol in Google Universal Analytics to parse our streaming server logs and post everything as events. But we’re now wondering how we can make this happen for GA4. For instance, here’s an example of a post we make with a PHP script using curl when someone tunes into one of our HD channels:


    We usually find these Events under the Behavior section in Universal Analytics, sorted under the Event Category of Stream. I wrote the script using the Measurement Protocol parameter reference, which now surprisingly shows a link to GA4’s Measurement Protocol at the top of the page – but without a similar guide to parameters. As you can probably notice, we’ve mainly posted to categories, actions, labels, and even custom groups.

    Here’s another example where a listener tunes into a show that posts to campaign source/media events:


    Any kind soul out there who can point us in the right direction for converting these to GA4 events?

    Dakota replied 10 months, 4 weeks ago 3 Members · 2 Replies
  • 2 Replies
  • Rishi

    21 June 2023 at 2:09 pm

    Sure! When switching to GA4 from Universal Analytics, the events need to be translated uniformly. In the case of Universal Analytics, ‘action’ (ea) maps to ‘event_name’ in GA4. Similarly, ‘event_category’ (ec), ‘event_label’ (el) and ‘event_value’ (ev) from Universal Analytics change to parameters with the same names in GA4 along with their respective parameter values.

    For instance, if you had an event in GA4 that corresponded to ‘Listen’ in Universal Analytics, you’d structure it like:

    gtag('event', 'Listen', {   
    'event_category': 'Stream',   
    'event_label': 'The Show',   
    'event_value': '10' 

    Here’s a handy Google help center article to understand this better.

  • Dakota

    2 July 2023 at 4:22 pm

    To convert your Universal Analytics events to GA4 events, you can use the GA4 Measurement Protocol API. This protocol works a bit differently from the previous one. In GA4, instead of events being categorized under Event Category, Action, and Label, data is sent as event name and parameters. The event name can be any string and you are allowed to send up to 25 additional parameters with each event, which can be values or nested parameters. For example, in your case, the ‘Stream’ category can likely be the event name and ‘Listen’ can be a parameter for that event. There should be similar restructuring for other parameters as well. It’s also important to note that some parameters are reserved for automatically collected events and you should avoid using these names for your custom event parameters. Ensure to check the GA4 documentation for more details.

Log in to reply.