GA realtime api with custom dimensions - google-analytics

I want to query the google analytics realtime api using one of my custom dimensions.
In the regular api (not realtime) I can do this as follows:
'metrics': 'ga:pageviews',
'filters': 'ga:pagePath=~/myPath*;ga:dimension2=='+myVal
However, when I change the metrics to 'rt:activeUsers', I got the error:
"Unknown dimension(s): ga:dimension2"
when I did the request.
I changed the separator in the filters string from semi-colon to & and I didn't get the error any more, but the result always returns 0
Is it possible to do filtering on the realtime api? TIA

The realtime API does not support custom dimensions (you can see the list of supported dimensions and metrics here). On possible reason is that at least the values for session- and user-scope dimensions cannot be determined in realtime since realtime reports based on hits. So you cannot filter based on a custom dimension.
There is a possible workaround, but that comes with a caveat that makes it mostly pointless. You can create an additional data view, and then use an advanced filter to copy the custom dimension value for the hit to a dimension supported by the realtime API - e.g. you extract the value from your custom dimension and copy it to the "source" field (or some other field). Then you query for/ filte by the source field to retrieve the value. The caveat is that the original value of the source data field (or whatever field you overwrote) will be lost.

Related

Why Firestore "projects.databases.documents.list" also includes document fields?

In Firestore there is a principle of creating small documents and big collections. However this doesn't make seanse if we use Firestore using it's REST API, because listing collection also prints content of all documents within it. This doesn't make sense to me at all, shouldn't it be supposed to just return id's of all documents? Here is the exact method I'm talking about: https://firebase.google.com/docs/firestore/reference/rest/v1beta1/projects.databases.documents/list
The API is working correctly. If you don't want any document fields (or limited fields), you can use the mask parameter as described in API docs you linked:
object(DocumentMask)
The fields to return. If not set, returns all fields.
If a document has a field that is not present in this mask, that field
will not be returned in the response.

Marketo REST API - what is "dedupeFields" for custom objects?

When it comes to creating/updating custom objects, can I use both dedupeFields or lookupField when pushing the data to Marketo?
What is the difference between the two?
I'm not sure what do you mean under lookupField, as there is no such input field described in the API documentation of the Sync Custom Objects endpoint. (That is the endpoint to create or update custom objects.)
In the other hand, you do not need such a standalone lookup field, as with the input array you provide the objects you want to create or update, with all their important values. Have a look at the sample payload in the docs.
When input is used together with the optional dedupeBy and action fields, you have full control over which object you want to create or update.
Also, the endpoint expects the name of the dedupe field under dedupeBy key, as opposed to dedupeFields. So the name is singular; you can provide a single field name use, and it does what you can expect: if the value in the field for a given record is not unique, an error will be returned for the individual record.

Marketo REST API - is there a way to get all records of a custom object?

I created a custom object and i want to get all its existing records. Is there a way of doing that via the REST API? Seems like a very basic and simple operation but i couldn't find information about it anywhere.
As you say, it seems like a basic task, but in the reality, it is more complex indeed.
Unfortunately, the Get Custom Object endpoint (which is the only endpoint to fetch Custom Objects) requires the filterType and filterValues parameters to be present as well. Basically this means that you have to have some information about the queried objects beforehand.
Also, a further restriction is that the value of filterType can only be one of the “searchable” fields of the Custom Object, meaning that it has to be either a Link field or a Dedupe field. (These fields are listed under the searchableFields property in the response from the Describe Custom Objects endpoint.)
So as mentioned above, you have to know the values for at least one of the properties of your Custom Objects before you make the query.
With additional queries though, you can grab these required values.
Let's say, you have your Custom Object linked to the Lead Object, and the Link field is called Owner Email (with the REST API name being ownerEmail) which links to the Email Address field of the Lead Object. In this case you could set the filterType to ownerEmail and set the emails of the leads as filterValues.
Then it is up to you how you gather the emails of those Leads who has a Custom Object attached. Luckily the REST API won’t throw an error if you provide a value that has no corresponding Custom Objects.
If your Custom Object is linked to a Lead, it's a bit complex but you can do like this:
Create a smart list and filter with "Has You Custom Object"
Get the smart list with API (GET /rest/asset/v1/smartLists.json)
Based on this list of Leads, get all Custom Objects (see the other answer).

Google Analytics API Custom Dimension name

I'm using the Reporting API v4 and collecting information about Custom Dimensions.
https://developers.google.com/analytics/devguides/reporting/core/dimsmets#view=detail&group=custom_variables_or_columns&jump=ga_dimensionxx
I am able to get dimensions like ga:dateHour but am unable to find a dimension that I can receive the "name". I want to pull in the names "zcode" and "ztest"
described in this picture Custom Dimensions
Am I missing a dimension or metric in this API to achieve this?
Thanks!
The name is used in the reporting interface only. In the API you address custom dimensions by the keyword "dimension" followed by their respective numeric index.
So in your example you would retrieve values for "zcode" by querying "dimension1".

Google Calendar API: can i retrieve entries changed/created after a specified date?

Can i retrieve entries changed/created after a specified date? This is regardless of the event date - only by "modified date". I.e. if i modify an old even i want to be able to retrieve it using a query (without knowing its id)
I haven't tried it myself but according to the documentation you should be able to access all events updated within a certain range using the standard Data API query parameters updated-min and updated-max.
See: http://code.google.com/apis/calendar/data/2.0/reference.html#Parameters
and: http://code.google.com/apis/gdata/docs/2.0/reference.html#QueryRequests
I'm not sure if you are using a code library to access the Google Calendar API so I cannot comment further.

Resources