In Universal GA there are a number of pre-set metrics available to you that represent averages; things like 'avg time spent on page' and 'avg Bounce rate'. However when I create a custom metric, it seems there is no way to calculate the average of it, you always see the sum.
Is there a way to view the average of a metric rather than just the sum ?
I understand that Universal GA is still in public beta, is this just a feature that has been missed out ?
In the current version of Analytics you can now use "Calculated Metrics". Those can be used for creating averages, among other things. You cannot use them for min/max though, it is limited to rather simple calculations.
So if your CustomMetric is gathered at hit-level, you want to define your calculated metric CustomMetricAvg as
{{CustomMetric}} / {{Page Views}}
You didn't miss anything. Calculated metrics are not available.
There's now a Google Analytics feature request for this, please star it or add your comment (hopefully Google Analytics team will notice).
The other option is to export the data and do the calculations outside of Google Analytics. You could do a normal CSV/Excel export, use the Core Reporting API, or try the Magic Script.
Related
I am targeted to research whether this is doable:
To create a calculated metric (Order Submit) in google analytics (https://analytics.google.com/). I am using UA (not GA4). So I am going to create it in a view.
Order Submit:
Before 2021/12/18: [ga:eventAction] like '%Submit Button Click%'. value should be sum of [ga:uniqueEvents];
After 2021/12/18: [ga:eventAction] like ‘%checkout%’ and [ga:eventLabel] like ‘%2%’,value should be sum of [ga:totalEvents];
The ultimate goal is going to use the field via Google analytics API v4 in python. I know how to get the calculated metric via API once it's defined. But I couldn't figure out how to do the case statement for the calculated metric. It looks it can only handle simple operation on existing metrics, e.g. metric 1/ metric 2.
If that's not possible, any workaround?
BTW, I know in google data studio I can possibly create something like that using case statement, but it can not be used in google API v4 I suppose?
This is not possible with calculated metric. The walkabout is to get all related dimensions and metrics in a table. Then you can calculate by yourself using SQL or whatever language depending on where you stored the data.
I am setting up a report based on a calculated metric in Google Analytics. I would like to divide the total number of a specific event action with the number of users. Something similar to:
{{Total Events (MyEventCategory / MyEventAction)}} / {{Users}}
I have tried to find documentation on this feature. The autosuggestion when creating the calculated metric do not suggest the above is possible, but I would like to shout out and hear if anyone out there know whether or not this is possible.
In Google Analytics, how can I get a single number that is a change between two periods?
For example, I have a bounce rate in December that is 28%. I have a bounce rate in Januaray that is 22%. How can I get a widget on the page to just show -6%.
What you're referring to is known as a "calculated metric", and currently there's no way to do this in Google Analytics (outside of the built-in calculated metrics like ga:percentNewUsers).
The best way to do this right now is to make two queries to the API and write some code that does the calculation yourself.
Since you mentioned having a widget on the page that displays this data, you might look into the Embed API to do the queries
I'm using the Google Analytics Real Time API (https://developers.google.com/analytics/devguides/reporting/realtime/v3/) to track the active visitors per minute. For this, I use the metric rt:activeVisitors. Everything is working fine.
However, I want to track the page views per minute, but I did not find any overview of available metrics.
Is it possible to fetch the current page views?
You can find a list of the Dimensions and metrics available in the RealTime API here : Dimensions & Metrics Reference
It doesnt look like page views is something you can see in the RealTime API
As seen here: https://developers.google.com/analytics/devguides/reporting/realtime/dimsmets/pagetracking
You can use
rt:pageviews
the documentation is not really clear on the time frame. But my experiments seem to hint per minute.
The closest you can get is to use pagePath dimension and have activeVisitors as the basic metric (and the only one available, pretty much).
I don't think there is any real value in having live page view stats, you can find those in real time reports built-in standard GA reporting set anyway.
Tools like Mixpanel, KISSmetrics and others support cohort analysis out of the box but I've heard that you can do this with a bit of effort in Google Analytics as well. How do you set this up if you want to track, say, the daily and weekly retention of your visitors?
Google Analytics can do a lot but retention analysis is one of it's weak points. Since it tends to focus on visits (as opposed to visitors) you'll need to configure the cookie tracking yourself using Google Analytic's custom variables. Having said that, it's not too hard to get a simple solution running quickly.
First, decide how to layout the data in Google Analytic's custom variables based on your requirements. For example, are you storing retention dates for daily, weekly or monthly tracking? Do you also want to track cohort goals? Partition this data into the available custom variable slots.
Write the cohort data to these custom variables when visitors arrive or achieve goals using Google Analytic's _setCustomVar function. Setting the fourth parameter of that function to 1 indicates you want to do visitor-level (cookie) tracking.
For each cohort you wish to analyze, create an advanced segment in Google Analytics. Using a regex expression in the condition will give you the flexibility to segment for interesting cohorts. ex: "All users whose first visit was the week before Christmas".
Analyze the results with reports by specifying a date range and the corresponding cohort-sliced advanced segments. Another option is to extract the data using the Google Analytics Data Feed Query Explorer or their API.
Once you've put in the work your new visitors will be stamped by their first visit date and nicely fall into each daily or weekly retention bucket. If you need more detail there's a full walk through on my blog:
How to do Cohort Analysis in Google Analytics.
This really interested me so I did a little research and basically you have to customize the GA javascript in the pages to upload custom variables into google.
Once you have done that you need to go to "Advance Segments in Google Analytics" and select your custom variables. Here is a detailed description on how to accomplish this:
Hacking a Cohort Analysis with Google Analytics