Field SCREEN_VIEW is not a valid dimension - firebase

I'm using firebase analytics with my android app.
I followed this article https://firebase.google.com/docs/analytics/screenviews?hl=en and now I'm tracking screens manually.
As you can see below it's working
Now I try to retrieve this data with the runReport-method https://developers.google.com/analytics/devguides/reporting/data/v1/rest/v1alpha/TopLevel/runReport as follows
{
"dimensions": [{
"name": "screen_view"
},
{
"name": "firebase_screen"
}
],
"metrics": [{
"name": "myMetric?"
}]
}
I get the return message
Field screen_view is not a valid dimension
I don't know what I'm doing wrong.

Here's your reference of all the dimensions and APIs you can use: https://developers.google.com/analytics/devguides/reporting/data/v1/api-schema
I think what you're having issues with is that the "screen_view" dimension doesn't exist. This is because if you go into your Firebase Console. "screen_view" is actually an EVENT.
So in your case, to solve, you would actually have to get the dimension "eventName" and FILTER for the "screen_view" name.

Related

Firestore Pagination : how to set Cursor for startAt using Rest Api

I'm using firebase firestore using Rest API to get data limited by 5 documents only, ordered by a field called LikesCount.
When I want to fetch the next 5 documents I have to use startAt and pass the LikesCount value of the last document from the first 5 documents.
But in this way, it will fetch wrong data when there is another document with the same LikesCount value So I tried and searched a lot about how to pass the last Document id in addition to the LikesCount value But all of them did not work In addition, I tested the pagination using the Web SDK and it was working correctly because you can pass the document snapshot easily, but what does the document snapshot object include? So that we can understand the structure of the Cursor and apply it to the REST API.
I tried to use this method to pass the Document ID as referenceValue
{
"structuredQuery": {
"from": [{
"collectionId": "Users"
}],
"where": {
"compositeFilter": {
"op": "AND",
"filters": []
}
},
"orderBy": [{
"field": {
"fieldPath": "LikesCount"
},
"direction": "DESCENDING"
}],
"startAt":
{ "values": [
{
"integerValue": "6"
},
{
"referenceValue": "projects/myprojectid/databases/(default)/documents/Posts/xEvmJ1LLHwTKVREQfXtX"
}
],
"before": false
},
"limit":5
}
}
But an error will occur : Cursor has too many values.
also, I tried to pass only the referenceValue and it still did not return the correct 5 documents.
Thanks in advance :)
Your orderBy() has 1 field (LikesCount) but your startAt() has 2 fields. I suspect that is the reason for the error message?
Passing the integerValue won't work. If there are 13 results with the value 6, then each time you make the above call you'd get the same first 5 results.
When you say:
I tried only passing the referenceValue and still did not get the correct 5 documents
what documents are you getting? What documents were you expecting to get?

"Unexpected token } in JSON" (Firestore connecting through Zapier)

Attempting to hook up a trigger from Zapier when a Firestore document gets added, Zapier asks for an orderBy element. Documentation (https://zapier.com/help/firebase/#creating-a-firestore-structured-query-for-a-trigger) seems pretty straightforward, but I get an error that
ERROR: We had trouble finding a sample. The specified query does not contain valid JSON. Unexpected token } in JSON at position 123
I tried a couple of variations (see below for 2 examples), but I keep getting the same error each with a different position.
"orderBy": [{
"field": {
"fieldPath": "timestamp"
},
"direction": "DESCENDING"
}],
(Result: Position 123)
"orderBy": [{
"field": "timestamp,
"direction": "DESCENDING"
}],
(Result: Position 46)
I'm not even sure where Zapier is getting the JSON, so I can't look at the JSON to see if anything is funky.
Does anyone know how to fix, or at least how to view the full JSON file?
The issue is the trailing comma after the last ], which makes it invalid JSON.
Actually it's this one trailing comma, which renders the query invalid: ]},} - that should be ]}}.
The full JSON can usually be downloaded in the Firebase console; at least for Realtime Database.
And when it complains about JSON syntax, just use JSONLint; most IDE also highlight syntax errors.
According to Zapier documentation:
"orderBy": [{
"field": {
"fieldPath": "someKeyOfYourChoice"
},
"direction": "DESCENDING"
}]
This worked for me. There are more cases of troubleshooting, I highly suggest to check the site out if you still experiencing some issues:
https://zapier.com/help/doc/common-problems-firebase#creating-a-firestore-structured-query-for-a-trigger

Retrieving previously calculated route [HERE Maps] using RouteeId fails with RouteNotReconstructed error

I'm calculating routes based on user input. Then storing the routeId and any additional informations I need. But the shape of the road is something I need occasionally; when the user wants to get a preview of the road again.
Since I don't want to store all the points from shape I tried using getroute endpoint (https://developer.here.com/documentation/routing/topics/resource-get-route.html#resource-get-route) but I get this response:
{
"_type": "ns2:RoutingServiceErrorType",
"type": "ApplicationError",
"subtype": "RouteNotReconstructed",
"details": "Error is NGEO_ERROR_ROUTE_DESERIALIZATION",
"additionalData": [
{
"key": "error_code",
"value": "NGEO_ERROR_ROUTE_DESERIALIZATION"
}
],
"metaInfo": {
"timestamp": "2018-08-01T15:01:56Z",
"mapVersion": "8.30.86.150",
"moduleVersion": "7.2.201830-34436",
"interfaceVersion": "2.6.34",
"availableMapVersion": [
"8.30.86.150"
]
}
}
So the question is: why do I get the error? Following the API documentation https://developer.here.com/documentation/routing/topics/resource-type-error-route-not-reconstructed.html I can exclude wrong routeId (it works for routes saved e.g. today but not for the older ones).
The route was calculated using the same version (7.2)
Is the routeId stored only for a certain amount of time?
If so, how long?
RouteID changes with map version.
https://developer.here.com/documentation/routing/topics/request-route-information.html
You'd need to recalculate periodically to get up to date RouteIDs.

Freebase MQL query - Get data by a social link

I'm having a hard time trying to get data about a person from Freebase using his social link - by a MQL query.
How could this be done?
Something like:
https://www.googleapis.com/freebase/v1/mqlread?query={
"*":[{}],
"/common/topic/social_media_presence":[{
"value":"http://twitter.com/JustinBieber"
}]
}
Those links are really stored as keys and the links are generated from templates with they key plugged in. You can see all the keys here: https://www.freebase.com/m/06w2sn5?keys=
A modified version of your query would be:
[{
"key": [{
"namespace": {
"id": "/authority/twitter"
},
"value": "JustinBieber"
}],
"*": [{}]
}]
You can do the same thing with other namespaces like /authority/facebook or /authority/musicbrainz as well as the various language wikipedias e.g. /wikipedia/en
I'm not sure how complete the coverage or currency of the social media info is though...

How to "Add guest" to event via google calendar API?

could you please give me a hint on how to share a single event via google calendar api?
That is I'd like to invite other users to see the event programmatically without sharing the whole calendar. To mimic the "Add guests" UI action
As Claudio mentioned, you need to use the Google Calendar Advanced API for this.
You'll want to use a patch because you don't want to replace all the other data on the calendar invite. However, even in the case of patch, since the attendees lives in an array, if you attempt to pass a patch such as this:
{
attendees: [ { email: "new#example.com"} ]
}
... it'll replace all old invitees (i.e. it'll remove anyone that was on the invite before you called patch). To fix this, you must first get the current invitees, add a new person to the array, and then send a patch.
You can see a detailed example of this in this answer which also explains how to use Google Apps Scripting to ensure an email is sent to the user when adding them to a calendar event (see the addGuestAndSendEmail() method in that post).
You can use the API to add people to the attendees collection:
https://developers.google.com/google-apps/calendar/v3/reference/events/update
refer the following request.
method: POST
endpoint: https://www.googleapis.com/calendar/v3/calendars/primary/events?sendUpdates=all
here, sendUpdates means when you add any guest so he would get an invitation mail used based on scenario.
Input Json:
{
"kind": "calendar#event",
"etag": "etag",
"status": "confirmed",
"summary": "JayKara",
"description": "eqwbdjhwhhwhhwrhjehrhejhfj",
"location": "America",
"creator": {
"email": "#mail.com",
"self": true
},
"organizer": {
"email": "#mail.com",
"self": true
},
"start": {
"date": "2019-12-23"
},
"end": {
"date": "2019-12-24"
},
"originalStartTime": {
"date": "2019-12-24"
},
"visibility": "public",
"attendees": [
{
"email": "****#mail.com" //this guys are the guest
}
]
}.
After that there is no patch method required your guest guys will receive an invitation whenever update event
Cheers!

Resources