I am tracking a number of events on a website and am trying to extract some analytics data via the api. The problem I have found can be boiled down to this scenario. If I want to know how many unique events have happened per day, I can run a query such as:
?start-date=2016-02-19&end-date=2016-02-24&metrics=ga%3AuniqueEvents&dimensions=ga%3Adate
which will give me table of the number of unique events per day from Feb 19th to Feb 24th. In my specific example, I will have a row that say I had 12914 unique events on Feb 22nd.
If I now change the time period for the query to something like this:
?start-date=2016-02-01&end-date=2016-05-01&metrics=ga%3AuniqueEvents&dimensions=ga%3Adate
I will basically get the same table, only from Feb 1st to Mai 1st. Was suprises me though is, that now the column for Feb 22nd reads 12966 events, while my assumption would be, that this number should actually stay the same.
Is there something I'm missing here? In which scenario would these numbers make sense? Thanks for your help!
Check the API response for the value of containsSampledData.
Sampling is the practice of selecting a subset of data from your traffic and reporting on the trends available in that sample set.
You can specify the sampling level to use for a request by setting the samplingLevel parameter to HIGHER_PRECISION.
You can also try simplifying your request by shortening the date range, or requesting fewer dimensions.
Related
I got a rare problem with our account, I using google API v3 to get data from google analytics.
the first request using dimension ga:year ga:month
second request using dimension ga:channelGrouping
both requests have a similar for another parameter:
start date (2015-07-17) end date (2019-11-27)
metrics a:goalCompletionsAll,ga:goalConversionRateAll,ga:goalValueAll,ga:sessions,ga:pageviewsPerSession,ga:avgSessionDuration,ga:percentNewSessions,ga:bounceRate,ga:users,ga:pageviews
and different summary start when start date under 27 Sept 2017
has anyone experienced the same thing?
Considering the large period of time analyzed and that you are querying a non-standard report, it's likely that you're getting sampled data.
About data sampling: https://support.google.com/analytics/answer/2637192?hl=en
You can specify the sampling level to use for a request by setting the samplingLevel parameter: https://developers.google.com/analytics/devguides/reporting/core/v3/reference
You can understand if a Core Reporting API response contains sampled data by containsSampledData field in the response (in this case the containsSampledData response field will be true).
Note: Data is sampled when reports that include the Users and Active Users metrics include data from before September 2016.
I mean like, count how many clicks the website since beginning and get their country location.
i already testing Google Analytics API but it requires to input date range, which i want from the beginning but no "Since beginning" or "All data" option available.
will set start date from year 2007 works? any suggestion?
will set start date from year 2007 work
Sure, why shouldn't it. The limit is the number of rows your query returns (10 000 per query. Number of row depends on the number of distinct values for the selected combination of dimensions) and the frequency with which you run your query, not the timeframe selected.
You can test this with the Query Explorer were you can run your metrics/dimension combinations without writing API code, so you can first check if you get the expected results.
I'm trying to get all unique visitors for a selected time period, but I want to filter them by date on the server. However, the sum of unique visitors for each day isn't the number of unique visitors for the time period.
For example:
Monday: 2 unique visitors
Tuesday: 3 unique visitors
The unique visitors for the two days period isn't necessarily 5.
Is there a way to get the results I want using the Google Analytics API (v3)?
You're right that Users aren't additive, so you can't simply add them day by day. There are several ways around this.
The fist and most obvious is that if you've implemented the User-ID you should be able to straight up pull and interrogate the data about which users saw your site on which days.
Another way I've implemented before is to dynamically pull the number of Users from the Google Analytics API whenever you need it. Obviously this only works if you're populating a live web dashboard or similar, but since it's just the one figure you're asking for, it wouldn't slow down the load time by much. Eg. if you're using a dashboarding tool such as Klipfolio, you may be able to define a dynamic data source, and query Google whenever you needthe figure (https://support.klipfolio.com/hc/en-us/articles/216183237-BETA-Working-with-dynamic-data-sources)
You could also limit the number of ways that the data can be interrogated, and calculate all of them. For example, if you only allow users to look at data month-by-month or day-by-day, then you only need those figures.
Finally, you can estimate the figure with reasonable accuracy by splitting it into two parts. New Users are equal to New Sessions (you're only new on your first Session), which is additive, so that figure can be separated out and combined as required.
Then, you could take a rough ratio of new to returning Users (% New Users) from, say, 1 year of data, and use that with the New Users figure to generate an average on any level.
I just know that the GA filters can't apply to historical data, so does it mean the filter would only apply to the date while it enabled?
For example, I added an IP address filter at 15th Aug, then removed it at 16th Aug. Then the report will always filter that IP address's data at 15 Aug, even after I removed the filter, is it working like that??
Thanks!!
Yes, that is how it will work. It's a good idea to always have a separate master profile that remains unfiltered, in case you do something like this and need the data from that filtered period.
GA Unique Visitors data isn't making sense to me. From the GA FAQ we get the following definition for 'Visits vs. Visitors'
"The initial session by a user during any given date range is considered to be an additional visit and an additional visitor. Any future sessions from the same user during the selected time period are counted as additional visits, but not as additional visitors. "
The part that I can't resolve with the GA graph is "Any future sessions from the same user during the selected time period are counted as additional visits, but not as additional visitors". For the graph below covering a 30-day period, I would understand the GA definition to mean that the data represents uniqueness across all 30 days, right? But if you look at the screen shot below, you see a regular pattern for each week over the 30-day period the report covers. From that, it seems the numbers we are seeing associated with each of the days of the graph (e.g. 3.92% (4142) for Tuesday, September 8) is a count of unique visitors just in the context of that one day - i.e. without correlating their uniqueness to the rest of the days in the 30-day period. If the graph actually showed uniqueness across the 30-day period, I would expect the daily numbers to start high in the early days of the period and decrease over the 30-day period as the number of already-seen visitors (i.e. returning visitors) increases, no?
What am I missing here?
UPDATE
Helpful clue from Jonathan S. below got me on the right track.
I think I understand now what the daily bar graph values mean, but it's a little counter-intuitive and I'd bet not what some others might be assuming as well. The reports states "39,822 Absolute Unique Visitors" at the top, which means just that: over the 30-day period we saw this many uniques. Fair enough. The confusing part is that the daily (or weekly) bar values in the graph below are not mutually exclusive uniques as I had assumed, but are values relative only to the 39,822 total - i.e. there is overlap between the unique visitor counts across any group of days. This means the sum of the daily % values > 100% and the sum of the daily count values > 39,822. The algorithm is: when you visit for the first time in the 30-day period, call that "today", you add 1 to the total (39,822) and 1 to the "today" bar value. When you show up again "tomorrow", you are NOT counted again in the total, but ARE counted as 1 in the "tomorrow" bar value.
alt text http://img.skitch.com/20090922-djti81ejj5gqn575ibf8cj1e8x.jpg
I believe it's just an issue of grouping. The top right of the graph has 3 icons to group by day, week, or month. It's currently grouping by day. So if I visit your site today and come back tomorrow, I'll be counted once for each day.
I tried looking at the month view for one of my sites but it didn't give me much meaningful data. I believe the above should answer your original confusion though.
Is it possible that you're searching for something what isn't existing anymore? Unique Visitors/Visits is old terminology. Check: https://www.seroundtable.com/google-analytics-sessions-users-18424.html
Then check how sessions and users are defined:
Sessions ("ex-visits", it's very detailed): https://support.google.com/analytics/answer/2731565?hl=en&ref_topic=1012046
Users in Google Analytics reporting are defined as "Users who have initiated at least one session during the date range". So IMHO it's not about 30 days, it's about the SELECTED date range.
I hope this helps.