Converting Google Universal Analytics events to GA4 - google-analytics-4

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?

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.

Related

GA4 Conversion tracking using Measurement Protocol

[Edited. Added code sample and more explanations]
Is anybody familiar with the GA4 Measurement Protocol?
We are sending events from our backend servers to the server-side GTM container using the GA4 Measurement Protocol. Everything works fine except for conversion tracking. The events marked as conversion are not counted as conversions if we send those via MP (except for the default "purchase" event, it works perfectly). The same event with the same parameters counts as a conversion if we send it from the browser (client-side GTM). As I couldn't find anything about this issue online, the only thing left was to debug parameter by parameter using the server-side GTM preview mode. Here I discovered, that if I send events from the browser, the requests for events I mark as conversions in GA have "&_c=1" in their query string.
That means, as far as I understand it, that in order to get conversion events via MP, the event request needs to have "_c" query string parameter. I tried adding "_c" as an event param, but that didn't work. Is there a designated JSON parameter to mark the event as a conversion?
------------MORE INFO--------------
Here is an example of an event "Experts". This event gets sent from both the client-side and the server. As you can see in the screenshot, this event is marked as a conversion.
As you can see on the second screenshot, the actual events (137) are much more than the conversions detected (48). The difference are exactly the ones sent from the server-side.
Here is the request body of the server call:
{
"client_id":"Z9TLWnyVC2UK4UssPIVk8J+2n5BZhgWLtWSlFYYSwlg=.1642076344",
"user_id":"119412",
"events": [{
"name": "Experts",
"params": {
"tenweb_action": "[Test action]",
"tenweb_info": "[Some more info]",
"debug_mode":1,
"page_location": "https://10web.io/[some-test-page]"
}
}]
}
#Jan, #DaImTo, and everyone else that might have this issue in the future.
I think I've found a solution. Although it's unofficial and might break at any moment, it's the best one I've found so far. Here is what I ended up doing. While debugging via GTM preview mode I noticed, that in Event Data tab of conversion events there is an object "x-ga-system_properties", that, among other system variables, contains c:"1" . So I tried adding
"x-ga-system_properties":{"c":"1"}
to the event parameters JSON that we send to the Measurement Protocol endpoint of our server-side GTM.
IT WORKED. The events sent that way were registered as conversions by GA4.
Would be great to hear your thoughts on this. Do you think it's a stable solution? Do you think there will be official documentation on this from Google?

Google Calendar REST API does not return title and other event fields

Google calendar REST API GET method (https://developers.google.com/calendar/v3/reference/events/get) should return this structure (https://developers.google.com/calendar/v3/reference/events#resource), unless I'm missing something.
I need to get event title and description to use in my application. I 'm getting below response instead.
I've tried to change event visibility (public/private) and availability (free/busy). Actually, API does not show events with Free availability, for which I don't have solution either.
Here is event edit screen screenshot:
https://www.screencast.com/t/X8bRS8kJDT
{
"kind":"calendar#event",
"etag":"\"3145149995624000\"",
"id":"5fnlvcl2msab46p8roqbahhb6g",
"status":"confirmed",
"htmlLink":"https://www.google.com/calendar/event?eid=NWZubHZjbDJtc2FiNDZwOHJvcWJhaGhiNmcgZWQtYWRtaW4uY29tXzMwOHNycjdzdjdiM28xazRpdjZ2cm9mb3Y0QGc",
"updated":"2019-11-01T02:23:17.812Z",
"start":{
"dateTime":"2019-11-11T09:30:00+11:00"
},
"end":{
"dateTime":"2019-11-11T10:00:00+11:00"
},
"visibility":"private",
"iCalUID":"5fnlvcl2msab46p8roqbahhb6g#google.com"
}
Are there other methods to get calendar events details with REST API, including ones with free availability?
Thanks.
04/02/2020:
I actually made it work for "ordinary" Google account - add project, add API, add service account and allocate service account email to the calendar. But I still not sure how to change access level for G Suite account. It allows only to see Free/Busy status.
I've changed default access in Admin Console as this article suggests, but it does not help:
https://www.macworld.com/article/2980005/the-mystery-of-the-unsharable-google-apps-calendar.html
You could try specifying the fields you want to retrieve like the image below:
Or you could put a " * " as the image below to retrieve all values:
fields is a standard Query parameter, which specifies what values you want to include in your response. To learn more about it, you can check Here.

Here-api: REST geolocation api request change

Trying the Here geolocation api with wlan data, originally the json request body was an array of {mac, powrx} objects. Mac being the mac address of the WiFi AP, powrx being the RSSI received for the beacon frame.
Recently, I've noticed the powrx parameter is no more mentioned in the documentation (although accepted by the api).
Is the "powrx" parameter officially deprecated? Does it mean that the geolocation algorithm doesn't use this information (anymore) ?
I assume you are referring to "Positioning API" in HERE REST APIs (https://developer.here.com/develop/rest-apis)
I checked the documentation in:
https://developer.here.com/documentation/positioning/topics_api/definition-wlan-locate.html
and it still mentions powrx.
There are no plans to deprecate this or other Positioning API parameters. If any parameter should for some reason be deprecated, there will be a prior notice in the documentation (see for example parameter 'frequency' in https://developer.here.com/documentation/positioning/topics_api/definition-cell-cdma-nmr.html).

Actions on Google not passing parameters

I'm using Dialogflow (previously API.ai) to create an Actions on Google app.
Using Dialogflow I have set up a custom Entity to highlight single words from multiple Intents.
ie. mashable, recode, bbc sport are all words picked up as Entities.
The fulfilment sends a post webhook to an api I created.
When using Dialogflow it sends off
"parameters": {
"news-agent": "BBC Sport"
},
Which is fine, I set up API to detect the parameter and when using Actions on Google simulator
"parameters": {
"news-agent": ""
},
The parameter is blank, I don't see anything in the documentation about why this is happening.
Could someone help?
It's possible that Actions on Google is not picking up a value for the "news-agent" slot.
Try making the "news-agent" slot required in Dialogflow and define a re-prompt question for it.
That way, the event won't be sent to your app unless the "news-agent" slot is filled.

How to use standard events in the react native Facebook SDK

The Facebook SDK has the ability to record both custom events and standard events. The standard events are things like "Purchases" "Add to cart" "Completed Registration" etc...
Recording these standard events gives you access to specific bidding features on Facebook ads that you don't get without the events.
I have an app that has the React Native FBSDK
There are two methods for defining an event - one for purchases and one for everything else as seen here
There is zero documentation for standard events on react within the SDK on Github or on the event tracking docs on Facebook's developer platform.
Right now I'm trying to track the standard events by using their various names, as recorded across FB's documentation. I've tried the following:
AppEventsLogger.logEvent('FBSDKAppEventNameCompletedRegistration');
AppEventsLogger.logEvent('CompletedRegistration');
AppEventsLogger.logEvent('Completed Registration');
All of these just create custom events with those names, but aren't recognized as standard events.
Has anyone gotten standard events to work using the React Native wrapper for the FB SDK? If so how do you name the events to get FB to recognize them?
Update: As the comment below highlights, the more recent link is https://developers.facebook.com/docs/marketing-api/app-event-api/
It looks like you'll have to pass the strings that those standard events get evaluated to, i.e. instead of 'FBSDKAppEventNameCompletedRegistration', you'll have to use: 'fb_mobile_complete_registration'.
Here's the source:
Sorry if this is a bit late. Hope this helps.
I managed to find the actual event name by generating standard event code using tool on Facebook's documentation, run the code in AppDelegate.m, and get the exact key-values from Events Manager. With this roundabout way, I realized the actual name of Add to Cart event was fb_mobile_add_to_cart. From there I googled for the name and found the list documented in Marketing API (why not App Events?).
I don't know if it is the right place, but you can refer to https://developers.facebook.com/docs/marketing-api/app-event-api/ for actual standard event names and parameter names. At least it worked in my case. Here's my Add to Cart event code:
function logAddToCart(totalPrice, contentType, contentId, currency) {
const params = {
'fb_content_type': contentType,
'fb_content_id': contentId,
'fb_currency': currency
};
AppEventsLogger.logEvent('fb_mobile_add_to_cart', totalPrice, params);
}
I made a simple package with all events. Just import like
import FBEvents from "react-native-fbsdk-events";
// ...
AppEventsLogger(FBEvents.COMPLETE_REGISTRATITON, params);