How do I get the current count of a metric from Graphite - graphite

I am trying to get the value of a metric 'activelogins' from Graphite. I increment the value by 1 every time a user logs in and decrements it when he logs out. I need to show the current number of 'activelogins' in my dashboard.
Querying using
summarize(stats_counts.user.activelogins,"99years", "sum")
as expected just gives me the sum and not the current which I actually want.
How do I get the current count of 'activelogins' from Graphite ?

I imagine you could use the absolute of the derivative of stats_counts.user.activelogins and than summarize this, as in absolute(derivative(stats_counts.user.activelogins)).

Related

Custom field days remaining to finish a task

How can I create a formula that allows me, in a custom field, to calculate the remaining days of the task, with respect to the last data cutoff (Status Date), as long as it is not 100% complete?
I have tried to create a simple formula to perform the initial test of the remaining days, using the status date field and the end field, [End]-[Status Date], but the result is wrong.
Just use the "Remaining Duration" column that already exists in MS Project, it shows exactly what you are asking for.

Google Analytics: How to properly filter ga:1dayUsers and ga:30dayUsers

Question: What is the right way to filter active users based on the presence of an event?
I'm trying to report on a count of users that have performed a particular action (purchased an item) on my site.
The aim is to have a Daily Unique Buyer (akin to DAU or 1dayUsers) and Monthly Unique Buyer (akin MAU or 30dayUser) metric.
For the Daily Unique Buyer metric I have tried two separate approaches and I am getting different results for both.
Approach 1) Use ga:Users metric and apply filter ga:eventCategory=="Purchase"
Approach 2) Create custom Segment, Ensure that Advanced Filter condition is for Users (not Sessions) and set the same filter ga:eventCategory=="Purchase"
The first approach seems to yield the desired result when compared to the second.
Unfortunately, the first approach does not extend to computing the same metric for Monthly Unique Buyers.
Most post on StackOverflow suggest that creating a segment (approach 2) is the right way forward. This however, yields more users than events, which can't be correct.
Even more perplexing - Applying the segment in Audience -> Active Users interface yields a different result to programmatic app-script query below
const optArgs = {
'dimensions': 'ga:date',
'sort': '-ga:date','
start-index': '1',
'max-results': 250,
'segment: 'gaid::xxxx',
}
Analytics.Data.Ga.get(
myViewId, startDate, endDate, 'ga:1dayUsers', optArgs
);
update: For those that struggled with this. I don't claim to understand why, but I was able to get the correct number by querying the desired metrics 1dayUsers and 30dayUsers one date at a time.
Running the report over a date range failed. I checked this with the list of actual active users (under User Explorer in the interface) and both 1 day and 30 day metrics are correct.
Would love for someone to explain why this is needed.

Percentage of returning visitors in google data studio

Here what I want is get the number of returning visitor in percentage in scorecard.What I tried is tried creating calculating filed but didn't able to succeed
What I tried is applied the usertype = "returning visitor" filter but it shows only number and I want percentage.
Expected result is %returning visitors
Unfortunately, this method isn't entirely accurate. GA double counts a user if they are both a returning user and new user if they complete more than 1 session within the time period that you have listed.
My work around is to blend a data source with itself: 1 with a Google segment for returning users, 1 without.
The formula for the calculated field should use these two metrics:
ga:users (Users): total number of users
ga:newUsers (New Users): total number of new users
ga:newUsers/ga:users will give you the percentage of new users, the rest would be return. So just subtract the % from 1. Like so
Returning visitor in data studio
Showing the total number of returning visitors via the Scorecard
There is 2 ways to make it
1
Step 1
usertype = "returning visitor" pie chart or in table
Just make a new Pie chart or table then add to demensions Usertype
Step 2:
Add a new scoreboard
Make a filter for scoreboard just to show Returning of New visitors.
Done !! Showing the total number of returning visitors via the Scorecard.
Step 3 showing as a %
Add a new scoreboard without any filter and just show session.
Click at Scoreboard which shows Returning or New visitors. Click also in sametime at the scoreboard which shows session.. then right click on the mouse, choise the Merge data options.
Data studio makes automaticly percentage of both data. You get it!!!!
Second Way
You'll need to create a segment for in Google Analytics to use in Data Studio
Make a segment for returning visitors in Google Analytics.
Add a new scoreboard in data studio, choose just made segment. You will see the total Returning visitors in scoreboard.
follow step 2 and 3 ..
Good luck..

In Data Studio Filter Data to < Current Hour

I do a lot of day-of reporting and one of the things I'm trying to do is compare today's performance to another day. The trouble is I'm trying to comp. to that day to the last full hour. Essentially filter out all data in that comp day that happened after the last completed hour.
I've accomplished this in Tableau but I'd like for this report to be done in Data Studio. Is there a way of using functions to create a custom metric that returns the current hour? If I could get that I could easily use it as a filter for my report.
Thanks for any help.
Here's what the solution looks like in tableau:
IF [Session Hour (int)] <= [Current Hour]
THEN
[Revenue GA]
END
And:
DATEPART('hour', Now())-4
I was able to filter to the current hour by
a) making a calculated field to figure out the minutes difference between now and the data
minutes_before_now = datetime_diff(current_datetime(),the_time,MINUTE)
and b) filtering the data where this field was < 60
My advice would be to create a filter inside a date range, p.e.
And then you can choose the comparison range within the primary date range.
That's what I'd do, if I understood your question.

Google Analytics Checkout Behaviour in Bigquery

does anyone know how to extract checkout behaviour from the Google Analytics export in BigQuery?
E.g. I'd like to calculate abandonment at each checkout stage. I've raked through the schema -
https://support.google.com/analytics/answer/3437719?hl=en&ref_topic=3416089
but it doesn't seem to have the equivalent data from GA i.e. the details within shopping stages such as
"CHECKOUT_1_ABANDONMENT"
.
I can get each checkout step using hits_eCommerceAction_step but can't calculate exits here, they're always just blank when I do a count of hits.isExit
hits.isExit refers to the last page in the session. It will not help you here, unless you want to know if any step was also the session exit.
Regarding e-commerce steps, you could define the highest step number per session as being the exit step or the last one seen - but I guess the highest makes more sense?!
Oh, and you have to translate what each step number means by yourself. It literally just tracks the number, not the meaning.
You can do it like that:
SELECT
(SELECT MAX(ecommerceaction.step) FROM t.hits) AS maxStep,
SUM(totals.visits) AS sessions
FROM `project.dataset.ga_sessions_2018*` t
GROUP BY 1
ORDER BY 1
If you want the "last step in a session"-logic, you would do it like that:
SELECT
(SELECT ecommerceaction.step FROM t.hits WHERE ecommerceaction.step is not null ORDER BY hitnumber DESC LIMIT 1) AS lastStep,
SUM(totals.visits) AS sessions
FROM `project.dataset.ga_sessions_2018*` t
GROUP BY 1
ORDER BY 1
I didn't check if these are translations to Google Analytics numbers but should be helpful, I hope, getting in this direction.

Resources