Mixable metrics and dimensions in google analytics - 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:

Related

How to analyze multiple query parameters in Google Analytics

I'm setting up Google Analytics for a website where a user can find an event to attend (concerts, plays, etc.). The results can be filtered by 5 different parameters.
So, unfiltered results would look like: example.com/event-finder/
And filtered results showing concerts in January or February would look like: example.com/event-finder?type=concert&month=jan,feb
I'm struggling to figure out the best way to use the query parameters in Google Analytics to analyze filtering behavior.
Example questions I'd want to be able to pull answers for:
What percentage of results were filtered by type?
What percentage of results were also sorted by month?
What is the most common type filtered by?
I have full access to both Google Analytics and Tag Manager but I suspect I shouldn't do this with events or custom dimensions and that there's got to be a way to use the query parameters to do this in a clean way.
I've tried to use a new view and site search to group the types of filters. Seems like it could work, but seems hacky and limited.
I've considered pushing those values into custom dimensions, but that too seems like overkill.
I've considered pulling content reports into Google Sheets and sorting through things there, but I'm 1) not entirely sure how I'd do that and 2) suspect there may be an easier approach.
Let me know if you have any questions or need more clarification. Thanks!
Have you tried to use "category parameters" when configuring site search (admin -> view settings)? You could set the "type" as a category parameter. You can also enter multiple parameters in there.
Check this screenshot of site search configuration

Session numbers pulled from API dont match the numbers displayed in the Google Analytics Report

For my recent project, i m trying to develop a brand new report for google analytics using the Sessions data over a period of time.
When I compare the numbers that I get from https://ga-dev-tools.appspot.com/query-explorer/ and check the report that we have created in analytics.google.com the numbers for sessions are off. They dont match exactly. They are off by like 1%. What might be the reason for this.
Can someone please help me here?
I can give more details if needed.
Thanks
Adding to the above , one more thing I noticed
This happens only When I add Segment filter to be specific. Without the segments the numbers for all users look good.
Had a call with Google Analytics support. They say that there isnt actual support for the Rest Api code and the Front End report from Google Analytics has built in Logic to filter out certain personal information like age related, sex, etc. which is not there in the Rest Api when it pulls in data.
So this is the reason why the numbers are off by 1% all the time.
Hope this helps
Thanks

Google Analytics query builder, first touch for source

I'm still fairly new to Google Analytics but I want to achieve the following table using the query explorer.
source | # first touches | customers with source as first touch | avg customer life-cycle value
I have tried the following query
metrics: ga:sessions
dimensions: ga:source
But I don't really know how I can access the first touch data.
First touch means the first time a person visited your site. Also known as first interaction.
Is this even possible by just using google Analytics?
Edit: Maybe there is a way to link an id to the Google Analytics data?
I'm not a GA expert but I think this approach would be the best.
Use custom variables and/or dimensions to link a user id to for an referrer for example.
You could also try and save it into your own database if it's acceptable.
This is how we solved it once at my company.

How to track "page views per minute" using Google Analytics Real Time API?

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.

Can I find the most popular keyword for a particular page using the google analytics api?

I was hoping to to use the analytics api to find out the most popular search terms (organic) that lead to a particular page.
Is this possible?
I've trawled the documentation and found this which looks as if it outlines all possible data I can retrieve from the API and I can't see this information here.
http://code.google.com/apis/analytics/docs/gdata/gdataReferenceDimensionsMetrics.html
If this is the case, is there any reason that the API isn't complete? I would assume if I can access the data using the analytics interface then I should be able to query for it using the API - is this assumption incorrect?
Yes, this is possible. For example, if you wanted to see what keywords led to how many entrances to index.html,
Set:
Dimensions: ga:keyword
Metrics: ga:entrances
Segment: gaid::-5
Filters: ga:landingPagePath==/index.html
Sort: -ga:entrances
(Segment gaid::-5 segments the data to only include visits referred from Organic Search; sorting by -ga:entrances will order the number of visits in descending order).
Try it out here: http://code.google.com/apis/analytics/docs/gdata/gdataExplorer.html?dimensions=ga%253Akeyword&metrics=ga%253Aentrances&segment=gaid%253A%253A-5&filters=ga%253AlandingPagePath%253D%253D%252Findex.html&sort=-ga%253Aentrances&start-date=2010-09-23&end-date=2010-10-07&max-results=50

Resources