Reputation: 423
We parse our streaming server logs and post as events using the Measurement Protocol in Google Universal Analytics. I having a hard time finding how or if this could work in GA4. Here is an example post we POST using curl from a PHP script for someone listening to one of our HD channels:
v=1&tid=UA-123456789-1&cid=a76-b177-b238-b39d-634225a16b6e&ds=web&ua=AppleCoreMedia%2F1.0.0.19G71%20%28iPad;%20U;%20CPU%20OS%2015_6%20like%20Mac%20OS%20X;%20&ul=en-us&uip=1.2.3.4&cs=event&cn=station&cm=stream&ck=WXYZ%20HD3%20The%20Channel&t=event&ec=Stream&ea=Listen&el=WXYZ%20HD3%20The%20Channel&ev=10&cg1=Hour10&cg2=channel&cg3=Midday%20Weekdays%209am-1pm
We can then view these Events under Behaviors in Universal Analytics in our Event Category of Stream. I wrote this script using the Measurement Protocol parameter reference that clearly now shows a link to the Measurement Protocol in GA4 at the top of the page, but there is no similar parameter reference guide. As you can see, we've posted all mainly to categories, actions and labels even with custom groups.
Here is another for someone listening to a show that POSTS to campaign source/media events:
v=1&tid=UA-123456789-1&cid=a97-b76-b210-b2d-634225a16b6e&ds=web&ua=Mozilla%2F5.0%20%28Windows%20NT%2010.0;%20Win64;%20x64%29%20AppleWebKit%2F537.36%20%28KH&ul=en-us&uip=1.2.3.4&cs=event&cn=station&cm=stream&ck=The%20Show&t=event&ec=Stream&ea=Listen&el=The%20Show&ev=10&cg1=Hour1&cg2=podcast&cg3=Midday%20Weekdays%209am-1pm
Could someone be so kind to point me in the right direction if this is possible to convert to GA4 events?
Upvotes: 2
Views: 667
Reputation: 104
Here is how you can translate an event in Universal Analytics to GA4:
Universal Analytics | Google Analytics 4 |
---|---|
action (ea) |
Maps to event_name |
event_category (ec) |
Maps to an event_category parameter with a parameter value |
event_label (el) |
Maps to an event_label parameter with a parameter value |
event_value (ev) |
Maps to an event_value parameter with a parameter value |
Using your example, this is what the GA4 event would look like
gtag('event', 'Listen', { 'event_category': 'Stream', 'event_label': 'The Show', 'event_value': '10' });
For more information, refer to this Google help center article.
Upvotes: 1