Discrepancy between the Dimensions & Metrics explorer and Analytics API - google-analytics

There appears to be a discrepancy between the Dimensions & metrics explorer and the Analytics API v4. When adding the metric Transaction revenue together with Product name, SKU, item quantity and unique purchases yields the response
{
"error": {
"code": 400,
"message": "Selected dimensions and metrics cannot be queried together.",
"status": "INVALID_ARGUMENT"
}
}
even though according to the Dimensions & metrics explorer, they should be compatible.
You can try this yourself by visiting https://developers.google.com/analytics/devguides/reporting/core/dimsmets and checking the following dimensions/metrics from the Ecommerce category: ga:ProductSKU, ga:productName, ga:transactionRevenue, ga:itemQuantity and ga:uniquePurchases. The explorer should gray out incompatible dimensions and metrics as you select them but Transaction revenue is shown to be compatible.
I run the query using the endpoint https://analyticsreporting.googleapis.com/v4/reports:batchGet with the following JSON body. I've redacted the view id from the pasted body:
{
"reportRequests":[
{
"viewId":"[REDACTED]",
"dateRanges":[
{
"startDate":"2019-01-01",
"endDate":"2019-03-29"
}
],
"metrics":[
{
"expression":"ga:itemQuantity"
},
{
"expression":"ga:transactionRevenue"
},
{
"expression":"ga:uniquePurchases"
}
],
"dimensions":[
{
"name":"ga:productName"
},
{
"name":"ga:productSku"
}
],
"orderBys":[
{
"fieldName":"ga:itemQuantity",
"sortOrder":"DESCENDING"
}
],
"samplingLevel":"LARGE",
"segments":[],
"pageSize":100000,
"hideTotals":true,
"hideValueRanges":true,
"includeEmptyRows":true
}
]
}
According to the Dimensions & metrics explorer the above query should be OK but it yields the aforementioned 400 response. Removing ga:transactionRevenue from the JSON body yields a valid 200 OK response containing the report based on the parameters listed in the above JSON.
Is there something I'm missing here or is there an error in the explorer combinations?

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

Sabre Revalidate Itinerary with Ancillaries

I'm currently working on the integration of the API to be able to search, confirm the price and book.
Currently we have a problem on the second step:
What I'm trying to get is to have a revalidate response having also all Ancillary and Baggage (hand and hold, also with a fee) to be able to create the page to show the information about the reservation.
I've tried to add the following (in a successfully request):
"TravelPreferences": {
"AncillaryFees": {
"Enable": true,
"Summary": true
},
"TPA_Extensions": {
"VerificationItinCallLogic": {
"Value": "B"
}
}
},
but I'm getting following error:
AIR EXTRAS SUMMARY REQUEST REQUIRES AT LEAST ONE GROUP CODE
Error during Processing
For the luggage, with this part
"Baggage": {
"CarryOnInfo": true,
"Description": true
},
I'll get info about baggage but no prices.
Any idea?
Thank you!

Number of dimensions allowed in GA4 data API

While going through the new GA4 data API documentation, I didn't come across any specification for the number of dimensions allowed in a single request.
It seemed like there was no upper limit. This document doesn’t mention an upper limit and states the following:
“In a report request, you can specify zero or more dimensions.”
However when I try executing the v1alpha:runReport API via postman I get this response if I give more than 8 dimensions:
{
"error": {
"code": 400,
"message": "Requests are limited to 8 dimensions within a nested request.\n This request is for 9 dimensions.",
"status": "INVALID_ARGUMENT"
}
}
Has the number of dimensions allowed in a request been reduced to 8? If yes, can you point me to some document that states this?
The earlier UA batchGet API used to allow max 9 dimensions and I was expecting the same limit with the new GA4 data API.
Steps to Reproduce:
Post a request to v1alpha:runReport with more than 8 dimensions:
Request URL: https://analyticsdata.googleapis.com/v1alpha:runReport
Request Auth: A valid bearer token
Request Body:
{
"entity":{
"propertyId":"123456789"
},
"dateRanges":[
{
"startDate":"2021-03-29",
"endDate":"2021-03-29"
}
],
"dimensions":[
{
"name":"eventName"
},
{
"name":"source"
},
{
"name":"medium"
},
{
"name":"hostname"
},
{
"name":"dateHour"
},
{
"name":"deviceCategory"
},
{
"name":"browser"
},
{
"name":"city"
},
{
"name":"country"
}
],
"metrics":[
{
"name":"screenPageViews"
},
{
"name":"userEngagementDuration"
},
{
"name":"eventCount"
}
]
}
The Google analytics GA4 data api is a brand new api, released as part of GA4. As such it has not been reduced to 8 dimensions this is the current limit as it stands
Requests are limited to 8 dimensions within a nested request.
The Google analytics reporting api may allow for additional dimensions and metrics but they are it's a completely different system. You can't compare universal analytics and GA4
Note: i have submitted a note about the lack of documentation to the team
Updated docs state up to 9 dimensions are now allowed.
https://developers.google.com/analytics/devguides/reporting/data/v1/basics#dimensions

LinkedIn v2 API: 500 failure when fetching standardized data using projections on multiple organizational entity statistics requests

Problem Description
Projections for the function and seniority standard data fail with a 500 error code and an unknown reason when fetching data from multiple organizational entity statistics endpoints.
Problem Scope
Affected Endpoints
/v2/organizationalFollowerStatistics
/v2/organizationPageStatistics
/v2/brandPageStatistics
Affected Organizational Entities
Organization
Organization Brand
Affected Standardized Data
Functions
Seniority
Sample Request
GET "https://api.linkedin.com/v2/organizationalEntityFollowerStatistics?q=organizationalEntity&organizationalEntity=urn:li:organization:PAGE_ID&projection=(elements*(*, followerCountsByFunction*(*, function~), followerCountsBySeniority*(*, seniority~)))"
Sample Response
{
"elements": [
{
followerCountsBySeniority: [
{
"followerCounts": {
"organicFollowerCount": 1,
"paidFollowerCount": 0
},
"function!":{
"message":"URN Resolution failed for unknown reasons.:com.linkedin.r2.RemoteInvocationException:GatewayException{_serviceErrorCode=null}",
"status":500
},
"function":"urn:li:seniority:2"
}
]
},
{
followerCountsByFunction: [
{
"followerCounts": {
"organicFollowerCount": 1,
"paidFollowerCount": 0
},
"function!":{
"message":"URN Resolution failed for unknown reasons.:com.linkedin.r2.RemoteInvocationException:GatewayException{_serviceErrorCode=null}",
"status":500
},
"function":"urn:li:function:2"
}
]
},
...
]
}
Additional Information
Querying the /v2/seniority and /v2/functions endpoints using a GET request with their respective IDs successfully returns the expected data.
Projections for other standardized data (e.g. country, region, industry) work as expected.
Application permission scope granted: "r_emailaddress r_ads r_basicprofile r_liteprofile r_ads_reporting r_organization_social rw_organization_admin r_1st_connections_size"

Google Analytics calculated metric not available from core reporting API

Here's how the calculated metric is defined in the Google Analytics web interface:
Name
Profit
External Name
calcMetric_Profit
Formatting Type
Currency (Decimal)
Formula
{{Revenue}} - {{Shipping}} - {{Tax}}
The "External Name" field has this description:
The external name is used to uniquely identify the calculated metric when querying via API. External names may contain alphanumeric and underscore characters only. Special characters, symbols, and spaces are not allowed.
When I request the metric from v4 of the reporting API, using this request:
POST https://analyticsreporting.googleapis.com/v4/reports:batchGet?key=<redacted>
{
"reportRequests": [
{
"dateRanges": [
{
"startDate": "2018-01-01",
"endDate": "2018-01-22"
}
],
"metrics": [
{
"expression": "ga:calcMetric_Profit"
}
],
"viewId": "<redacted>"
}
]
}
I get this response:
400
{
"error": {
"code": 400,
"message": "Invalid value 'ga:calcMetric_Profit' for metric parameter.",
"status": "INVALID_ARGUMENT"
}
}
Am I doing something wrong?
Is this related to calculated metrics still being in Beta?
Change your startDate to one day after you created the calculated metric. Calculated metrics apply from the date they were created (there is no retrofilling). So if your startDate is before the date of creation, the API will throw an error, as the calculated metric doesn't exist for the dates prior to it being created.

Resources