Retrieve Google Analytics 4 event parameters via API - google-analytics

Google Analytics (particularly version 4, "GA4") has various predefined events, each with its own parameters. E.g. the purchase event has an items parameter, which contains data such as item_id and item_name for each purchased item. JS code on a website can send these events and pass the extra data, and I can actually see the data in the "Analysis hub" in the Google Analytics interface.
Is there a way to also fetch this extra data using the Google Analytics Data API? There is a way to retrieve some predefined dimensions and also "custom dimensions" (via customEvent:parameter_name), but e.g. purchase item data doesn't seem to be a part of that.
Do I have to define custom dimensions (e.g. a purchasedProductId) and send them in addition to the items parameter, if I want to access this data via API?

Jan,
Ecommerce reporting is not yet supported in the Google Analytics Data API. I will update this question once I have more information about the timeline of this feature implementation.
Thanks,
Ilya
The Google Analytics Team

Related

How to get Paid User And Free User from google analytics

I'm New when it comes to google analytics and I have an Apps that use google analytics, but I got some question, Can we use google analytics to track paid and free user separately? If it can where I can find it in google analytics? I'm quite confused with a lot of information in there to use it in data studio
some metrics that I used right now from Google Analytics:
users -> to get all unique user that come to my apps
You can distinguish whether sessions that came or not from paid campaigns, but a user can have more than one session and each session could have been started by different channels, for example from a pay channel and another from an organic channel, but the user is always the same. So, with basic tracking, I'd talk about sessions and not users.
Yes, you can track such details, but you need to let Google Analytics know, who do you consider to be a free or a paid customer, as this is not a standard dimension. This can be achieved with Custom Dimensions.
Key steps involve:
Creating the custom dimension in Google Analytics administration. This is a property level setting. Based on your description, this will likely be a user level dimension.
You need to adjust your tracking code (or Google Tag Manager settings) to include the customers' level among the data, which is sent to Google Analytics. You need to refer the proper dimension ID, which you get during the creation of it.
You need to apply the given custom dimension to your reports. This can be done by using a secondary dimension within the standard reports, or by creating a Custom report. It is also possible by creating a segment of different users, and to apply this segment to various reports.
Further reading is available in this support article.

Google Analytics SDK UserActivity cannot show custom metrics?

The SDK reference
https://developers.google.com/analytics/devguides/reporting/core/v4/rest/v4/userActivity/search
shows that custom dimensions are part of the result Activity, but custom metrics are not mentioned
I have a very simple problem, but cannot seem to find the answer anywhere:
How can I get the google analytics data, event by event, including my custom metrics?
Lets say given a client id
I have tried connecting the dataLayer variables through Tag Manager to Google Analytics in various ways and cannot find the custom metrics in detail (i.e. raw, event by event) anywhere in Analytics - Seems that only Analytics 360 allows it via BigQuery; but there must be a way using the SDK
Or is it just not possible?

iOS: Issues with switching from Google Analytics to Firebase Analytics

I am using Google Analytics for years for my iOS apps and was truly satisfied with it. For my regret Google is sunsetting Google Analytics later this year so I am switching to Firebase API so I can keep tracking my apps. I already done most of the integration work and can see the events appearing in Firebase console. However, I can't see custom parameter values but only event count.
For example, sending event named add_book and adding parameter named isbn with value of 1234, I will be able to see in the console only the number of times that add_book arrived and also that it contains an isbn parameter. However, it seems there is no way to view the value (i.e. 1234) of the isbn parameter. I registered the isbn parameter for the add_book event as required. Am I missing something?
Does having the full functionality of the sunsetting Google Analytics (including advanced filtering + regex filters, etc.), means I should use both Firebase Analytics and BigQuery together?
By the way, I linked Firebase Analytics with BigQuery and exported the data as suggested by Firebase Analytics, but I can't see any Analytics tables yet in BigQuery. Do I need to allow several hours before I can view the exported data?
As of March 2019, Firebase Analytics is not so easy to use or test when setting it up (in comparison to Google Analytics). The main steps for setting up event parameters are:
Send your events with their event parameters. Send at least 80-90 events of one type, otherwise the parameters will appear as zero or "not set", until you reach 80 individual events.
The events will not display in the website until after one day. So wait for 24 hours.
When the events appear on the website, you must register their event parameters, with the '3 dots' menu -> "Edit Parameter Reporting" - Like this:
Then:
(Image credit: Firebase Analytics custom events params and Firebase Analytics. Can not add custom parameter to event )
After registering the event parameters, you must wait another 24 hours to see the parameters displayed on the website.
More info:
https://www.reddit.com/r/androiddev/comments/9zbvk4/alternative_to_google_analytics_not_firebase/
https://www.tatvic.com/blog/firebase-analytics-reporting-tips-overcome-limitations-favorite-mobile-app-analytics-tool-google/
In your event overview from Firebase Console you can enable parameter reporting for individual events. The option is found in the 3 dot overflow menu.
You can do that for up to 10 unique text parameters and 40 unique numeric parameters.
Beyond those limits or for more control BigQuery is the way to go. And yes you need to wait for your first data in BigQuery. They populate a new table with one days data every day once.

Track individual via Google Analytics

I am new to Google Analytics. I have a conversion set up, and I'd like to capture demographics for individuals who convert at e individual level. When a user converts, I'd like to pass the statistics from Google Analytics into my own database, or keep a record of the ID assigned at conversion in Google Analytics and download the data. Is this possible? I want to do analysis on who is likely to convert versus not - age, shopping habits, etc - and link these details back to the type of specific conversion.
Thoughts?
We if want to add add track users at individual level, try creating a Custom diamension and passing the userID everytime you make a GA call.
Next to view the same :- in tables that you view your analytics data, there will be this option called 'Secondary diamention', from the list that appears.. Choose the custom diamension name that you had assigned. Now you will be able to see each row with the userID along slide.
Add user ID to your tracking script
The first step to your question is to add the user ID to your tracking. If you have some way to identify users on your website (ie: through email marketing tool, your CRM, etc), then you should set up user ID tracking. Here is the Google Dev article about that:
https://developers.google.com/analytics/devguides/collection/analyticsjs/cookies-user-id?hl=en
However, basically... you just have to add this to your tracking script (replacing the 'create' line you currently have, replacing "USER_ID" with the user ID your system gives them.
ga('create', 'UA-XXXXX-Y', { 'userId': USER_ID });
In addition, I usually include this UserID as a custom dimension, so that I can view it in Google Analytics and other reports. To do this, first set up a custom dimension for your ID, as a "User-level" dimension. Then just add this after your user ID is available (assuming this is your first custom dimension):
ga('set', 'dimension1', USER_ID);
Connect User ID to Demographics
Unfortunately, the demographics information that Google Analytics provides (under "Audience") is not compatible with custom dimensions (like userID). So, the API only allows you to pull the audience data in aggregate (ie: connected to City, number of users, pageviews of those types of people... etc). If this works for you, check out the GA Query Explorer (below) to try out different combinations of dimensions & metrics to drill down as deep as you can and maximize the information you gain from this demographic info.
Connect Google Analytics Data to Your Database
In order to connect GA data to your database in an automated fashion, you will need to set up some kind of scheduled process that runs a query off of the Google Analytics API. To explore what combinations of metrics and stuff are available, I'd suggest checking out the Google Analytics API Explorer and the Google Analytics API reference material. What I did was set up an SSIS package (using SSIS GoogleAnalyticsSource) as the data source, which made it fairly easy. Then just scheduled that to run daily, populating the data I want into my database.
Alternatively, you could download less complicated reports directly from Google Analytics and import them into your database with something like SQL Server Management Studio.

Sending custom data to google analytics

I've been developing a Smart TV app and integrated google analytics. Now I can see number of page view etc. But what i actually want to do is to send a custom data string to google analytics and control "assetid" variable. I want to track number of contents whose "assetid" var is 0.
A sample custom data below:
assetid=11031&type=vod&sessionid=me7ujh7kqemg9jkqegh80cjtv2&checksum=4574d2362e51a398086a6e8ff87de447
Do i need to convert it to JSON or Array and what should i do to track it on google analytics?
This sounds like an application for Google Analytics' Measurement Protocol
That gives you a format to craft URL that will send into GA what you are asking. You can use your sessionid to GA's cid to match users over multiple sessions.
It works by making a simple POST to Google Analytics, which you can load with events or custom dimensions that match your needs of the Smart TV. Dev guide here

Resources