Google Analytics: UniqueEvents affected by different EventValues? - google-analytics

Does UniqueEvent also consider the EventValue field?
Let's make an example.
In the same user session, these two analytics are sent:
1)
EventCategory = "UI"
EventAction = "Click"
EventLabel = "Result"
EventValue = 5
2)
EventCategory = "UI"
EventAction = "Click"
EventLabel = "Result"
EventValue = 3
do they count for 1 or 2 UniqueEvent?
I have been assuming so far that EventValue is irrelevant for the UniqueEvent, and it could even be used for sending the current timestamp.

The Unique Event definition is:
Unique Events: The number of times during a date range that a session
contained the specific dimension or combination of dimensions.
One important thing to notice is that Unique Events has nothing to do with Events. If this sounds confusing is because it is, but stay with me.
Unique Events is a special metric in Google Analytics it is context dependent. The number of unique events will depend on the dimension, or combination of dimensions you use.
Want proof that unique events has nothing to do with events? Go to an account with a bunch of pageviews and 0 events, and try to create a report of any dimension by page, the number you see should be close to unique pageviews (but not quite).
Event Value is a metric not a dimension, so it can never influence unique events.
Now to your question on whether your example counts as 1 or 2 unique events, the answer is not defined unless you define the actual report you are trying to do.

Related

Google analytics API: different sum of sessions with 'ga:eventLabel' function and without it

I added 'ga:eventLabel' function to my script and sum of sessions decreased from 2238 to 994. Why?
I expect the same result from both script
dim=['ga:eventLabel', 'ga:source','ga:sourceMedium']
met=['ga:sessions', 'ga:users']
start_date='2019-07-01'
end_date='2019-07-03'
transaction_type='Goal'
goal_number=''
refresh_token=token
condition=''
data_2=google_analytics_reporting_api_data_extraction(viewID,dim,met,start_date,end_date,refresh_token,transaction_type,goal_number,condition)
viewID='*********'
dim=['ga:source','ga:sourceMedium']
met=['ga:sessions', 'ga:users']
start_date='2019-07-01'
end_date='2019-07-03'
transaction_type='Goal'
goal_number=''
refresh_token=token
condition=''
data=google_analytics_reporting_api_data_extraction(viewID,dim,met,start_date,end_date, refresh_token,transaction_type, goal_number,condition)```
Here are the results:
--
The two queries have two different meanings, and won't give you the same result, unless you have a data set, where all sessions have at least one event type hit associated with them.
The first query says: count all my users and sessions for the given date range, breaking it down by event label, source, source/medium and date. So in this case, you implicitly filter for any known event labels, where (not set) is an empty, but existing label for a recorded event. Sessions without any events are excluded.
The second query says: count all my users and sessions for the given date range, breaking it down by source, source/medium and date (regardless, if they had any events).
You can verify this behavior, if you create these custom reports in Google Analytics web UI. It is similar to querying custom dimensions: if no value was set for a given custom dimension, those records are excluded.

Why would totals.visits be NULL on a row where totals.newVisits is 1

I'm running a query to pull source, medium, some custom dimensions, new sessions (totals.newVisits), sessions (totals.visits) and session duration (totals.timeOnSite).
I get some results where there is a value for totals.newVisits, but not totals.visits. How would that be possible - isn't a new visit supposed to be a subset of all visits?
You have to see these 2 variables ("totals.visits" and "totals.newVisits") as indicators (booleans).
Here, we want to know whether the user have already gone to the website before the visit or he is a returning visitor (totals.newVisits) and whether the user have done an interaction during the session or not (totals.visits).
In that case, it's 2 independent variables.
That is why Google specify these variables like :
The value is null if there are no interaction events in the session.
or
If this is the first visit, this value is 1, otherwise it is null.
You have to really stick into Google's variables definitions : BigQuery variable dictionary
From definition for totals.visits
The value is null if there are no interaction events in the session.
Added
Definition for totals.newVisits
If this is the first visit, this value is 1, otherwise it is null.
how can there be a value for newVisits if there are no interaction events?
I would interpret this as: New User visited page but there was no interaction
See more at BigQuery Export schema

Working with event stat in google analytics api

I have the website where merchants sell some stuff. Each item has stats like unique views during last 24 hours, a week and a month and a number of visitors that clicked on "show contacts" button. Uniqueness based on IP. This works, there're huge tables that collects all (IP,item_id) pairs during the last month, and there're a lot of updates.
Today I dig into google analytics api, I would like to know if it's possible to use it instead of my system.
The fact is all this stat is private, available only for merchant, so I don't need to have all stat at a time (it's not compared etc.). So it might be requested on demand for the specific item.
I created service account, connected it to analytics data and it seems export works (based on this example). Then enabled event tracking for "show contacts" button.
For example, when user click on "show contacts" where should I add item_id? Is it eventLabel or eventValue? So, for item_id=1234 it should be
ga("send","event","Contacts","show","",1234) or ga("send","event","Contacts","show",1234)?
I'm confused with eventValue column in Top Events report (it seems that eventValue keeps a sum of all eventValues and even caculates Avg.Value). Does it mean item_id should be stored in eventLabel as string?
I added second, nonInteraction event for collecting item views, ga("send","event","Data","show","1234",1,{nonInteraction:true}). It count all events, but I need only unique ones (performed by unique visitors) in specified period of time (day, week, month). Is it possible?
1) The parameters are category, action, label and value. "Value" is a metric and is expected to be an integer. Since it's a metric it will be added up. So if you do
ga("send","event","Contacts","show","",1234)
you will increment a metric by 1234, not store an id. You do not want this (especially if you have a linked adwords account, since this will be used to calculate your "return on advertising spent").
You want to use your item_id as label, however label is a string. So what you need to do is:
ga("send","event","Contacts","show","1234")
i.e. wrap the value for your label in quotes.
2) Is there anything wrong with ga:uniqueEvents for your purposes ?

google ga api multiple dimensions value, return less data than I expected

Possible similar question: GA total results is significantly less with hour dimension than with date dimension
-hour-dimension-than-with-date-dimens
but i use samplingLevel=HIGHER_PRECISION
I am registering my events as follows:
ga('send', 'event', 'search_event_category', 'search_term', 'location');
category = search_event_category
action = search_term
label = location
I would pull a report via the ga api to return me on the rows the relationship between action and label:
["search_event_category",
"search_term",
"location",
"2"]
I got this return using the following parameters in the query:
metrics=ga:totalEvents
dimensions=ga:eventAction,ga:eventLabel
&filters=ga:eventCategory==search_event_category
&samplingLevel=HIGHER_PRECISION
&start-index=1
&max-results=10000
But I realized that the total results is less than I expected:
totalsForAllResults": {
"ga:totalEvents": "57623"
}
I expected totalEvents 80832. In GA interface, i get this value
when I send "dimensions=ga:eventAction" i get "totalsForAllResults": {"ga:totalEvents": "80832"}
when I send "dimensions=ga:eventLabel" i get "totalsForAllResults": {"ga:totalEvents": "57623"}
when I send "dimensions=ga:eventLabel,ga:eventAction" It looks like it does a 'inner join' and i get "totalsForAllResults": {"ga:totalEvents": "57623"}
I'm doing the right way?
UPDATE 1
I know how difficult without help data, but put here pictures that prove that there is in ga relationship that was not returned by the query
evidence that the relationship exists in ga
If you're sending events to GA that don't include an event label, then when you query for events and specify the ga:eventLabel dimension, events without a label will be dropped from the returned result set. That's the most likely reason for the number discrepancy.
To avoid this problem, I'll sometimes set the event label to "(not set)" to mimic how GA internally indicates that a dimension value is unknown.

Google Analytics events sequence

I want to get from google analytics the list of events for all my users. And I want to be able to say "this event occured before this event", it means I want to know the sequence of the events, the order in which they were triggered.
I could already retrieve the list of events per user by doing a query that looks like this :
ids = foo
start-date = foo
end-date = foo
metrics = ga:sessions
dimensions = ga:dimensionX (dimensionX being user_id), ga:screenName,
ga:eventCategory, ga:eventLabel, ga:eventAction,
ga:date,ga:hour, ga:minute
With this I get the list of events by user_id, by screen, and by the time (up to the minute).
But ... minutes are not enough to be sure about the sequence of events. Moreoever, I couldn't find any ga:seconds dimension (does it exist ?), so I'm not sure if trying to get the sequence by time is a good thing. That is why I was wondering if there were a way to get a kind of "id" for the event, in order to sort them by the order in which they were triggered.
If there is no such thing, I was wondering if adding an ga:eventValue and setting the value to a timestamp would be a good thing ?
Thanks in advance !

Resources