Is GA Measurement protocol getting updated - google-analytics

According to here,
https://support.google.com/analytics/answer/11583528?hl=en
GAU must be updated to GA4 properties. I'm using measurement protocol to send data to both GA4 and GAU properties. So in order to send measurement protocol to GA4 property should I update my existing measurement protocol apps?
I can send data to GA4 property using v=2, tid=G-xxxxxxx parameters at the endpoint /g/collect. Will any of this change?

The Measurement Protocol (Universal Analytics)
is not being updated it will probably be discontinued when UA stops recording hits.
The Measurement Protocol (Google Analytics 4) is still being developed. It does not open for all events.
const measurementId = `<measurement_id_value>`;
const apiSecret = `<secret_value>`;
fetch(`https://www.google-analytics.com/mp/collect?measurement_id=${measurementId}&api_secret=${apiSecret}`, {
method: "POST",
body: JSON.stringify({
"client_id": "XXXXXXXXXX.YYYYYYYYYY",
"events": [{
"name": "refund",
"params": {
"currency": "USD",
"value": "9.99",
"transaction_id": "ABC-123"
}
}]
})
});

Related

ga4 measurement protocol new users 0

I have desktop app on Delphi. App send next data to https://www.google-analytics.com/mp/collect:
{
"app_instance_id": "47DA283039DE19AA64A5382C7936AE0F",
"events": [
{"name": "login", "params": {
"engagement_time_msec": "1",
"app_version": "3.5.37",
"client_id": "118"
}}
]
}
Google Analytics showing Active Users and Events. But New Users is 0. Also geolocation is no set.
I find answer, that needed pass a clint_id param ("client_id": "66676792622744477"), but after that GA cause an error:
{
"validationMessages": [ {
"description": "Unable to parse Measurement Protocol JSON payload. : invalid value oneof field 'AnonymousUserIdentifier' is already set. Cannot set 'client_id' for type oneof",
"validationCode": "VALUE_INVALID"
} ]
}
Help me please, whats wrong? How can I track New users and Geo via GA4 measurement protocol?
Try to send user_id information to GA4 Property: https://developers.google.com/analytics/devguides/collection/ga4/user-id?platform=websites

Google Analytics server side call err "The value provided for parameter 'tid' is invalid. using a valid" with measurement ID

I am trying to do a server side call to Google Analytics 4 with a valid Measurement ID (G-0GHN4RGNDQ) it's a test one, so OK to share here, see https://developers.google.com/analytics/devguides/collection/protocol/v1/parameters#v and the debug call here:
https://www.google-analytics.com/debug/collect?v=1&tid=G-0GHN4RGNDQ&cid=555&t=event&ec=MyCategory&ea=MyAction&el=MyLabel
I get this error
{
"hitParsingResult": [ {
"valid": false,
"parserMessage": [ {
"messageType": "ERROR",
"description": "The value provided for parameter 'tid' is invalid. Please see https://developers.google.com/analytics/devguides/collection/protocol/v1/parameters for details.",
"messageCode": "VALUE_INVALID",
"parameter": "tid"
} ],
"hit": "/debug/collect?v=1\u0026tid=G-0GHN4RGNDQ\u0026cid=555\u0026t=event\u0026ec=MyCategory\u0026ea=MyAction\u0026el=MyLabel"
} ],
"parserMessage": [ {
"messageType": "INFO",
"description": "Found 1 hit in the request."
} ]
I can successfully make gtag calls using that same Measurement ID and the events show up in Google Analytics... however I can't seem to get it to work via the /debug/ url above.
Any help appreciated.
You appear to be using the endpoint for
Measurement Protocol (Universal Analytics)
https://www.google-analytics.com/debug/collect?tid=fake&v=1
However yet you state you are trying to use Google Analytics 4 which implies GA4 and not Universal analytics.
You should be using Measurement Protocol (Google Analytics 4)
POST /mp/collect HTTP/1.1
HOST: www.google-analytics.com
Content-Type: application/json
<payload_data>
For validating hits check this page page
Note:
Remember the measurement protocol is used to send Data TO Google Analytics not request data from google analytics.

Setting debug_mode with Measurement Protocol (GA4)

Can't find a way to set the debug_mode parameter using Measurement Protocol 4.
Tried to put it everywhere (and naming it all i can think of) but without luck :)
Documentation is still very light and doesn't mention the debug_mode.
With web/js and GA4 it works fine!
Weird. Suddenly the debug mode started to work with code I'm 100% sure didn't work before.
Adding the parameter "debug_mode": true to the measurement protocol request will make it show up in Analytics' DebugView.
Sample json payload that works:
{
"client_id": "XXXXXXXXXX.YYYYYYYYYY",
"events": [
{
"name": "page_view",
"params": {
"page_location": "...",
"page_path": "...",
"page_title": "...",
"debug_mode": true
}
}
]
}
To add to the answers of #DalmTo and #bang - I wasn't seeing events I was sending over the Measurement Protocol show up in our GA4 Debug View. The root cause in my case was that the Measurement Protocol expects a funky format for the user_properties, but the following steps should help others debug other problems as well.
Steps I took to resolve:
Add the debug_mode: true field to individual event params as described in #bang's answer
Use the /debug/mp endpoint as described in #DalmTo's answer - this pointed me towards the errors in my user_properties format
Regarding the user_properties field, I was sending something along these lines:
{
"client_id": "XXX.XXX",
"user_id": "YYY",
"user_properties": {
"property_a": "value_a",
"property_b": "value_b"
},
"events": ...
}
Turns out GA4 / Measurement Protocol expect something like this:
{
"client_id": "XXX.XXX",
"user_id": "YYY",
"user_properties": {
"property_a": { "value": "value_a" },
"property_b": { "value": "value_b" }
},
"events": ...
}
At the time of writing, the only way to figure this out is to carefully check out the example here.
The measurment protocol for ga4 has two endpoints just like the measurment protocol for the old Google anlaytics
Measurement Protocol /mp/collect
Measurement Protocol Validation Server /debug/mp/collect
So if you send a event to it will be sent to Google anlaytics ga4
POST /mp/collect HTTP/1.1
HOST: www.google-analytics.com
<payload_data>
So if you send a event to it will be sent to debug endpoint for Google anlaytics ga4
POST /debug/mp/collect HTTP/1.1
HOST: www.google-analytics.com
<payload_data>

fcm xmpp protocal "delivery_receipt_requested" param

I use fcm xmpp protocol send push and Receive delivery receipt。
but starting from 2019-12-18, delivery receipts have begun to decrease, and 2019-12-20 there are no receipts at all,
I don't know why. my params no change. it's my param.
<message id='q2fcQ-183429'><gcm xmlns="google:mobile:data">
{
"delivery_receipt_requested": true,
"notification": {
"sound": "default",
"tag": "1",
"title": "title",
"body": "body",
"click_action": "push.welcome",
"android_channel_id": "notification.default"
},
"time_to_live": 600,
"message_id": "02b16456eba3483782fc471e3dd2cf73",
"to": "xxxxxxxxxxx"
}
</gcm></message>
I also ran into this problem 2019-12-20. Firebase stopped notifying delivery of notifications by the flag "delivery_receipt_requested".
See updates from 12/17/2016 FCM:
FCM has removed ongoing support for delivery reciepts via the XMPP protocol. In place of XMPP delivery receipts, developers should enable delivery data export in the FCM client SDK.
https://firebase.google.com/support/releases
Also, Cloud Messaging version 20.1.0 - https://firebase.google.com/support/release-notes/android#messaging_v20-1-0
Added setDeliveryMetricsExportToBigQuery(boolean) and deliveryMetricsExportToBigQueryEnabled() to control and query if messsage delivery metrics are exported to BigQuery.

How can I retrieve a RingCentral call recording from a monitored incoming call?

I'm monitoring incoming calls on RingCentral by listening for the Call Session Notifications (CSN) telephony/sessions event filter:
/restapi/v1.0/account/~/extension/~/telephony/sessions
From this, I will receive events like the following. The recordings property will appear to indicate a recording is available. How can I retrieve this recording?
{
"uuid":"12345678901234567890",
"event":"/restapi/v1.0/account/11111111/extension/22222222/telephony/sessions",
"timestamp":"2019-03-08T22:30:40.059Z",
"subscriptionId":"11112222-3333-4444-5555-666677778888",
"ownerId":"33333333",
"body":{
"sequence":7,
"sessionId":"1234567890",
"telephonySessionId":"1234567890ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz",
"serverId":"10.11.12.13.TAM",
"eventTime":"2019-03-08T22:30:39.938Z",
"parties":[
{
"accountId":"11111111",
"extensionId":"22222222",
"id":"cs12345678901234567890-2",
"direction":"Inbound",
"to":{
"phoneNumber":"+16505550100",
"name":"Jane Doe",
"extensionId":"22222222"
},
"from":{
"phoneNumber":"+14155550100",
"name":"John Smith"
},
"recordings":[
{
"id":"44444444",
"active":false
}
],
"status":{
"code":"Answered",
"rcc":false
},
"missedCall":false,
"standAlone":false,
"muted":false
}
],
"origin":{
"type":"Call"
}
}
}
There are two ways to retrieve the recording using information in the Call Session Notification (CSN) event, specifically the recordings[0].id property and the sessionID property.
retrieving a full media URL by calling the call-log endpoint with the sessionId property
manually creating recording media URL using the recordings[0].id property.
Note 1: While the call is ongoing, the recording will not be available for retrieval, even when the recording id is present in the Call Session Notification event. The recording will be available to be retrieved shortly after the call concludes.
Note 2: Call recordings can be in MP3 or WAV format determined by the company. To distinguish check the response Content-Type header for the MIME type when retrieving the recording media file.
1) Retrieving Full Medial URL via Call Log API
Making an intermediate API call to the call-log API has the dual benefits of being the official approach for receiving a media URL an providing more metadata for the call. In this approach, the recording.id in the call-log record will match the recordings[0].id property in the Call Session Notification event.
Both the company account and user extension call-log APIs can be called with the sessionId parameter from the event as shown:
GET /restapi/v1.0/account/~/call-log?sessionId={sessionId}
GET /restapi/v1.0/account/~/extension/~/call-log?sessionId={sessionId}
In this example, the sessionId is 1234567890 so you would have a Company Call Log API URL as follows
GET /restapi/v1.0/account/~/call-log?sessionId=1234567890
The response object will have a recording property that provides hypermedia links to get the media file. The file can be WAV or MP3 format which is communicated in the response Content-Type header.
{
"uri": "https://platform.ringcentral.com/restapi/v1.0/account/11111111/extension/22222222/call-log?view=Simple&sessionId=1234567890&page=1&perPage=100",
"records": [
{
"uri": "https://platform.ringcentral.com/restapi/v1.0/account/11111111/extension/22222222/call-log/1234567890ABCDEFGabcdefgh?view=Simple",
"id": "1234567890ABCDEFGabcdefgh",
"sessionId": "1234567890",
"startTime": "2019-03-08T22:30:29.505Z",
"duration": 35,
"type": "Voice",
"direction": "Inbound",
"action": "Phone Call",
"result": "Accepted",
"to": {
"phoneNumber": "+16505550100",
"name": "Jane Doe"
},
"from": {
"phoneNumber": "+14155550100",
"name": "John Smith",
"location": "San Francisco, CA"
},
"recording": {
"uri": "https://platform.ringcentral.com/restapi/v1.0/account/11111111/recording/44444444",
"id": "44444444",
"type": "OnDemand",
"contentUri": "https://media.ringcentral.com/restapi/v1.0/account/111111111/recording/44444444/content"
},
"extension": {
"uri": "https://platform.ringcentral.com/restapi/v1.0/account/111111111/extension/22222222",
"id": 22222222
},
"reason": "Accepted",
"reasonDescription": "The call connected to and was accepted by this number."
}
],
"paging": {
"page": 1,
"perPage": 100,
"pageStart": 0,
"pageEnd": 0
},
"navigation": {
"firstPage": {
"uri": "https://platform.ringcentral.com/restapi/v1.0/account/11111111/extension/22222222/call-log?view=Simple&sessionId=1234567890&page=1&perPage=100"
},
"lastPage": {
"uri": "https://platform.ringcentral.com/restapi/v1.0/account/11111111/extension/22222222/call-log?view=Simple&sessionId=1234567890&page=1&perPage=100"
}
}
}
2) Manually Creating Media URL
You can call the Recording API endpoint and retrieve the media directly by manually constructing the recording URL as follows:
https://media.ringcentral.com/restapi/v1.0/account/{accountId}/recording/{recordingId}/content
In this example, the accountId is 11111111 and the recordingId is 44444444 for the following:
https://media.ringcentral.com/restapi/v1.0/account/11111111/recording/44444444/content
The accountId in the URL path can be set to the currently authorized user's account using ~. Alternately, it can be set explicitly by extracting the accountId from the event property or using the accountId property in the relevant party object. Using ~ is the recommended way to set accountId.
Note: This this approach can be quick, it may be error prone as RingCentral has changed the media hostname once in the past. While there are no anticipated, future changes, calling the call-log API and retrieving the full media URL from the response is the safer and recommended approach. See below for this approach. This is only included as some people will try this and potentially run into issues later.
3) Hybrid Approach
The first approach of calling the call-log end point is the recommended approach, however, it involves an extra API call and most of the time the second approach should work fine.
A hybrid approach is to construct the URL as in approach 2 and then fall back to approach 1 if approach 2 returns a 404 or other error.

Resources