Is it possible to segment visits by goal completions in Google Analytics? - google-analytics

I have a website, and want to use the Google Analytics API to give me data that only includes visits with a specific goal completion (say goal 2). I'm trying to use the ga:goal(2)Completions metric in a segment to get this data like this:
segment=dynamic::ga:goal(2)Completions!=0
However, whenever I try this in the Query Explorer I'm told this is an invalid segment value. I don't see goal(n)Completions as a disallowed metric for use in segments in the documentation (https://developers.google.com/analytics/devguides/reporting/core/v3/reference#segment), so what's the problem here? Is there a different way to get this data segment?

It is because of
you shouldn't use "segment="
(n) value should be with out brackets.
ids= ga:XXXXXXXX
start-date= 2012-01-01
end-date= 2012-01-31
metrics= ga:visits
segment= dynamic::ga:goal2Completions!=0
I have tested and the sample above should work fine.

And if you want to do the opposite use
segment= dynamic::ga:goal2Completions==0
You can double-check it by running the query without segmentation - both above should sum up the the latest one.
Cheers

Related

How is Firebase analytics custom metrics calculated

I'm tracking data associated with an event, for this I put a parameter of programProgress(0 - 1), I created this in the Firebase console as a custom metric.
When I check the console all I see is a graph(attached) of what seems to be the average, no segmentation(like custom dimensions), no explanations. I've gone through multiple documentations and haven't found an answer.
Questions:
Is this graph an average of all data collected, what's the formula?
Is there a way to segment it(preferably in the console) and see amounts for different values i.e. 20 hits for 0.3, 40 for 0.4 etc
Is there a way to segment and see values for different custom dimensions i.e. 30 hits of 0.9 for x dimension(preferably in the console)
Thanks
I believe the easiest way to achieve what you're looking for would be to go into the Google Analytics (GA4) console directly and using the Segment Comparison feature in either the User Explorer or Cohort Explorer techniques.
You can build segments using the programProgress parameter and create multiple for each range you want to specify.

Google Analytics - user based segments

I have a user based segment created in GA that is working as expected. However, with user based segments, one can only apply a maximum date range of 90 days to the report.
This is as per their documentation (Limits on segments): https://support.google.com/analytics/answer/3123951?hl=en
Is there a workaround this? I have a use case where I would want to apply the user based segment over a date range of ~1-2 years to get a better sense on the trend over time.
If I re-create the GA report in Google Data Studio - is there a way to apply this user based segment over a longer date range?
Thanks!
No there's no option for extending 90-days reporting timeframe. The only solution is to get user-level data through the Reporting API and process them within 3rd party software. However, to do that you'll need some custom tracking implemented beforehand.

How to properly use sequences for attribution?

My goal is to see which customers originate from organic search, but convert via a different source later on.
To do this, I defined this segment:
Then, I look at the Source/Medium report, but the results seem off. I expected to see zero revenue in the google/organic row (as the segment should show users where the transaction is specifically not coming from google/organic.
Am I using the right tool for what I'm trying to achieve? And if so, what am I doing wrong?
The conversion path in Google Analytics is a better solution here. You can find it under conversions -> multi-channel funnels -> top conversion paths.
What you're going to see here is all the combinations of channels that have been used to generate a conversion, see the screenshot below.
If you have a bigger website you're probably going to have >10.000 different conversion paths depending on the time period that you select. What you want to realize is how much conversion value and conversion was generated in conversion paths that started with organic, but ended with a different channel. Simply apply the filter below in the report to retrieve that data. Please note that in the standard Google Analytics reports all conversions and conversion value are attributed to the last, non-direct click.
The solution is to add a condition that includes only sessions as described in the second step of the sequence. This will reduce the population from all users that present the pattern in the sequence, to only sessions that matter. See detailed explanation here: https://www.napkyn.com/2017/09/07/quick-google-analytics-trick-use-sequence-segments-to-analyse-behavior-over-multiple-sessions/

Mixable metrics and dimensions in google analytics

I'm doing some complex reports for google analytics and would like to ask you if the following is possible. The client wants to have just organic data for a bunch of metrics. Like pageviews, visitBounceRoutes, etc. The query I ended up with is the following:
https://www.googleapis.com/analytics/v3/data/ga?dimensions=ga:source,ga:medium,ga:keyword,ga:day,ga:month,ga:year&end-date=2013-11-20&fields=columnHeaders/name,rows,totalResults,totalsForAllResults&filters=ga:medium==organic&ids=ga:79067749&metrics=ga:pageviews,ga:pageviewsPerVisit,ga:visitors,ga:avgTimeOnSite,ga:newVisits,ga:visitBounceRate&start-date=2013-10-20
However the response is as follows:
'{"totalResults":0,"columnHeaders":[{"name":"ga:source"},{"name":"ga:medium"},{"name":"ga:keyword"},{"name":"ga:day"},{"name":"ga:month"},{"name":"ga:year"},{"name":"ga:pageviews"},{"name":"ga:pageviewsPerVisit"},{"name":"ga:visitors"},{"name":"ga:avgTimeOnSite"},{"name":"ga:newVisits"},{"name":"ga:visitBounceRate"}],"totalsForAllResults":{"ga:pageviews":"0","ga:pageviewsPerVisit":"0.0","ga:visitors":"0","ga:avgTimeOnSite":"0.0","ga:newVisits":"0","ga:visitBounceRate":"0.0"}}'
Can the dimensions ga:source,ga:medium,ga:keyword be mixed with the above metrics? It seems they can't since if I omit them the API returns an array of values 1 per each day within the specified range.
Where can I find more information about this and what categories are mixable? https://developers.google.com/analytics/devguides/reporting/core/dimsmets just shows all the available metrics but do not explains how they are combined and which one would be valid requests. I'm new at the analytics API and would be great any kind of help or guidance
Thanks a lot
Google Analytics Query Explorer is your friend for playing around with analytics dimensions/metrics/filters ;-)
Try http://ga-dev-tools.appspot.com/explorer/?dimensions=ga:source,ga:medium,ga:keyword,ga:day,ga:month,ga:year&metrics=ga:pageviews,ga:pageviewsPerVisit,ga:visitors,ga:avgTimeOnSite,ga:newVisits,ga:visitBounceRate&filters=ga:medium%253D%253Dorganic&start-date=2013-10-20&end-date=2013-11-20&max-results=100
Some thoughts:
Those dimensions & metrics should work -- maybe there was no organic data recorded during that time range?
Try removing the ga:medium==organic filter and see what your data looks like.
Does the profile you're using (ga:79067749) have any filters on it? If so, maybe try a different profile that has unfiltered data. (Analytics best practices -- make sure you have a profile with no filters applied that captures all data.)
As Mike said, there is no problem with the combination of metrics and dimensions you are using.
If you are entering the URL query directly in the browser problem might be the lack of URL encoding in your query string. For example, you need to convert == to %253D%253D
For example, instead of ga:medium==organic, you need ga:medium%253D%253Dorganic
If you build your query in the Google Analytics Query Explorer as Mike suggests, you can grab the direct link to your report by clicking the link symbol in the upper left:

Get more than 7 dimensions in google analytics

I am fetching my data from google analytics core api. I came to know that we can fetch only 7 dimensions using api, But here I need to fetch more than 7 dimensions with correct metrics. Is there anyway (other than using paid google analytics) to fetch more than 7 dmensions with correct metrics from google analytics.
If not, then is there any mathematical formula through which we can find intersection of dimensions fetched using 2 different dimensions having one dimension in common.
Thanks
The only way I have found around the 7 dimension limit is to be creative with filters. It will mean that you are sending more queries to the server, but if you aren't worried about your quota limit then its doable.
Example: ga:visitorType only has two values. New Visitor, Returning Visitor
So you could run a query with your 7 dimensions. Then add A filter ga:visitorType=New Visitor then run the same 7 dimensions with a filter added of ga:visitorType=Returning Visitor
Bingo you just got an 8th dimension.
Again you need to be a little careful because you are going to increase the number of queries you run by each value of dimension you are doing creative filtering on. I wouldn't recommend doing it with say ga:landingPagePath because the number of landing pages you have is to big. You will end up running too many queries. But there are a few you can do this with. ga:isMobile, ga:deviceCategory, ga:date. Just remember the more creative filters you add the more queries you end up running. I had one where I ended up expanding it to 80 requests just to get the data back I needed. Scary but it worked.
If you have specific dimensions that can be used to identify a session at a specific time (e.g. a session ID and browser timestamp), you can execute multiple queries then patch them together.
I built a python program that will do exactly this: https://github.com/aiqui/ga-download
This program can bring together multiple groups of dimensions, so that any number of dimensions can be downloaded and combined into a single CSV file.

Resources