Sending custom data to google analytics - 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

Related

Retrieve Google Analytics 4 event parameters via API

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

How does Google analytics get demographic data (age/gender)

Where does google get this data from and is it possible to manually obtain this data on my own website without it (assuming it is in some kind of cookie/user-agent string/identifier/etc)?
Google gets its data from the 3rd Party double click cookie.
Here is a bit more detail from the Google Analytics documentation
If you are looking to get similar data - you can purchase it from services like Comscore but you would need to get something to identify your users against their database.
Why don't you want to use cookie/ user-agent?
My personal perspective is that even if users block cookies- then some data is better than no data.
When a user logged in their google account, then google analytics collect demographic information like age, gender for that user.
There are also other sources for collecting demographic data along with google account information like:
Third-party double click cookie,
Android advertising ID,
IOS Identifier for advertisers.

Getting google analytics data per user

I'm looking to get information about users sessions from google analytics. Things like:
date of visit
referral
device type
exit page
browser
time on site
etc.
However, Analytics API seems to only offer this data as totals, and not per user. So I can't know how much a specific user stayed on the website for example.
The final result I'm looking for is to tie this data from analytics with the user id from our CRM platform using the google UUID saved in cookie.
Is it possible to retrieve this data from Analytics or you can only access it with Analytics 360?
User level data is not available in standard GA (except in a limited fashion via the User Explorer report which cannot be exported). You'd need to store user id or client id in a custom dimension (you must not store personally identifiable data in GA, even in hashed form, so take care what you use as user id) and then select this as first dimension when you export the data. Obviously this does not help you with data that's already been collected.

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.

How to track Registration form fields with Custom Variables in GA

I have a registration form with default fields and one drop down with 5 values say 1 - 5 And this field is mandetory.
How could i track this values thorugh Custom Variables for successful registered users?
What would be the other options if we cont track this through CV's?
Custom variables are pretty much a thing of the past - Universal Analytics has custom dimensions which are conceptually different and are not very well suited to store form input. Plus there is the danger that the form contains info that can be used to identify a person, and it's against Googles Terms of Service to store that in Google Analytics.
One possible way to solve this would be to create a Spreadsheet on Google Drive and publish it as a webapp to store the form data along with an anonymized ID per user; the same user id would be set as a session based custom dimension in Google Analytics. Using the Google Analytics Spreadsheet add-on or a bit of bespoke Google Apps Script you could then pull the relevant metrics per id into the spreadsheet to create your reports.

Resources