stackdriver: custom vs log based metrics - stackdriver

What would be the preferred way to record SLI metric,
by creating custom metrics and record the metric update programmatically
by write a log entry, define a custom log based metric
Question, looks like #2 could do the same job with no upfront latency, wondering what would be a good use case that #1 better?

Option #2 is better since log based metrics are based on the content of log entries and they can extract latency information reported in log entries, with custom metrics, you must have a metric descriptor for your new metric type.

Related

How can I add old data to a newly created metric on GCP stackdriver?

I want to create a new metric on Stackdriver and then check all the data before the metric was created based on it. Right now charts are showing only the new data. Is it possible?
E.g. I want to create a metric for API requests and then want to analyze the data based on labels I add. Right now I can do it only with the requests which are made after the metric creation, however I need the historical data too.
Stackdriver Logging does not backfill the metric from previous log entries. This is current limitation. You can find details here.

Track everything inside GA using only one custom dimension and one custom metric

What are the drawbacks of using a single custom dimension and a single custom metric in GA to track everything?
Ok, I am limited to 20 custom dimensions and 20 custom metrics for a property in GA. But the number of values for a single dimension is unlimited.
So, I will be able to, for example, create a dimension called Dimensio and a metric called Metri. Then, if I want to track a custom event called Ev1 I will tag on Dimensio with value Ev1 and on Metri with value 1.
I am just suspicious, why having such a solution GA ever worried about having 20 dimensions and 20 metrics (it would be enough to have 1 dimension and 1 metric).
Thank you.
There are numerous reasons/use cases where you'd want more than 1 dimension. I'd suggest some reading on scope.
One use case that will break the 1 dimension usage:
For a music streaming service, you want to track the user type (premium vs free) and as well as the version of the app (v1.0.1 vs v1.0.2) for debugging purposes.
The user type should be on a user scope, as in it will persist as long as the user doesn't clear their cookies. The version might be on a hit scope, as you might push out an emergency fix part way through the user session.
Using the above use case, you cannot report on the user type as well as version in the same report if you were only using one dimension.

Google Analytics - View doesn't report correct data when filtered with a Custom Dimension

I've set up a Custom Dimension at the website and the data is being registered correctly, as I am able to segment standard reports with a secondary dimension (using this Custom Dimension) and also to use this Custom Dimension as a segment.
However, when I set up a new View in GA filtering by this Custom Dimension, I see less than 20% of the data (sessions, pageviews, transactions, etc.) compared to what I see in a view without filters, but segmenting with the same Custom Dimension.
Has anybody had this kind of problem?
This can be an issue of the scope. For example, include view filter requires that filtered dimension be present in every hit. So if you're using session level custom dimension and only send it once per session then only 1 pageview will be there in filtered view. Contrary, Session segment requires that the filtered dimension appear at least once in the session and include all of the particular session hits.

Google Analytics: Is it possible to filter the raw data to create more valuable indicators?

We would like to build indicators that provide more useful information than "averages", e.g. instead of having to rely on "average time on page", we would like to create an indicator like "unique users that spent more than [threshold] time on page".
In order to do this, we need to know, whether Google Analytics is storing information on "user session" in connection with "time on page" in its raw data? And if it does, whether this raw data is accessible and can be filtered?
Another situation where the mentioned storing and filtering might come in handy, is the following: if different activities (e.g. post comment, click like, ...) are all tracked with regard to user session, we could build an indicator like: "unique users that performed any of the following: comment, like, ...".
Any reply, remark or comment is highly appreciated.
Raw data is not accessible in Google Analytics.
The closest you will get, if you have a GA360 account, is the BigQuery export, but even that is not "raw" in any meaningful sense (although it is more detailed). You could create a custom sendHitTask to send raw data to your own database.
But raw data would be not useful to you, since GA does not send session data with the raw data. Since 2012/the introduction of Universal Analytics, sessions are entirely calculated on the Google servers - the aforementioned BigQuery export would actually be more useful, since data there is already sessionized, but this requires the paid-for version of GA.
Usually there are workaround for most use cases - i.e. "more than time x" can be viewed as categorical data instead of as metric, so if you send a timestamp in seconds (starting with 0 for the first page view) with each hit to a session scoped custom dimension GA will only retain the last value per session. Then you can filter by all users where that dimension is bigger a given value (you need to use a regex, since you cannot compare dimensions as numbers, and I recommend to create "buckets" instead of having too many discrete values).
But to answer the explicit question, there is no access to raw data (unless you store it yourself) and it would not contain session data in any case.

Huge difference in Advanced segment and Custom Report

Why is the advanced segment and custom report in the below scenario not matching. Need your valuable suggestions from you all.
I have created a custom report to get sessions. I have done this by using the below query
Dimension as Device category
Metrics sessions
filters as page matches regex /products/phone/xperia-z
iam getting figues as mobile(sessions) = 869,908
However when i use a advanced segment on Audience-->Mobile--> overview. The query used in the advanced segment is
condition
Filter session using page matchesregex /products/phone/xperia-z
mobile(session) = 1,187,560
Could you please let us know why there is such a huge difference in custom report and advanced segment, though iam only interested in sessions
Comparing segments with custom reports is not a correct way of populating data. Whenever you apply a segment, it gives data for all the sessions in which your specified page was visited. Whereas in Custom Report, the filter works like a secondary dimension i.e. number of sessions from Mobile in which users directly landed on your page.
Try and using secondary dimension in Audience > Mobile report and your data will match.
// Hiren :P

Resources