i am working on an application that uses the Google Analytics Export API and i am trying to get the "Trend" result that Google shows against each of your site accounts as a percentage
ie UP 35.04% or DOWN 16.02%
How/where do they get this figure and is it available in the API somewhere.
i have tried comparing averages of last month to this month/first week of the period vs last week of the period etc, but i cannot seem to get the same numbers that Google provides.
any ideas?
thanks in advance
Doug
The formula is pretty simple (excluding today's data):
(Visits over the last 30 days - Visits
between 31 and 60 days ago) / (Visits
between 31 and and 60 days ago).
You can see it in action in the interface if you go to the default dashboard, where it shows you the last 30 days, then on the calendar, click "Compare to past" and select the default amount. It'll show you the numbers used for each calculation and the calculations as they appears in that account list.
The API does not, however, expose pre-calculated numbers (for example, they don't compute bounce rate for you; they just give you the pieces for it.)
So, you'd need to do two API requests to get this data. One for ga:visits in the last 30 days, and then one for ga:visits in the 30 days prior.
Then, when you get it, just subtract, divide, and multiply by 100, and you'll have the percent you're looking for.
UPDATE: The striked out part of the answer was true, but is no longer. The newest version of the Google Analytics API does provide access to some pre-calculated values.
Related
I'm using the Google-Analytics API to query my analytics for data using the Google Analytics Spreadsheet Add-on We then use the spreadsheet data in Google Data studio for a dashboard to display the data.
Everything has been going well for the last few months, however over the last 48 hours we have begun to receive sampled data when we query the API using the spreadsheet add on. This is undesirable for how we are using the data.
The total results that we were getting before being returned was about 1100 results. We have altered the date range of the query to be only 3 days whereas before we were querying since the start of the year.
Initially that worked and the results were no longer sampled. Then 24 hours later the data appears to be sampled again.
The documentation says the following regarding sampling for the free account:
Analytics Standard: 500k sessions at the view level for the date range you are using
We are not using our analytics that heavily so I cannot understand why we would have hit the 500K limit?
It is also not clear to me what a "View Level" is? Any help on this would be greatly appreciated.
I build application which pull sales data from Amazon and push it to Google Analytics.
I'm "hitting" transaction to Analytics and it's all works fine, the problem is that in Amazon the sales data updated after 48 hours (maximum) so I need to pull the report two days later.
Does anyone know if there's a way to send the date of the transaction? Can't find it in the Measurement Protocol API.
Thank you all, Peace and love :)
Not really. You have the queue time parameter (offset between current time and time the data was tracked), but as it says in the documentation:
Values greater than four hours may lead to hits not being processed.
"May" indicates that this is not a completely fixed limit but I'm pretty sure that 48 hours are not covered (Philipp Walton, a Google engineer who frequents SO once mentioned that the queue time limit is somehow related to timezones and rollover between days, so I'd guess that two days are way to long).
Apart from that there is as of yet no way to set a date for a hit.
You can try posting a Custom Dimension for each event you send, where the dimension is formatted to the date-time:-
e.g.
&t=event&cd1=20170423081321&cm1=24 etc
Only problem is: when you generate a GA custom report, the values are accumulated per day. If anyone knows how to get round that, would love to hear it!
Before Tuesday, March 14th, we saw the data lag in Google Analytics at approximately 1-2 hours. (It was never immediate.) You can see this effect on the Conversions > Ecommerce > Overview page if you search by date and select "today" to "today" (1 day's worth of data)
As of Tuesday, March 14th, we started seeing the lag for this overview report anywhere from 8-12 hours, with an inconsistent aggregation time. For example, it is now 4 PM here on the east coast (EDT), and here is a screenshot of our GA overview tab (I have obscured the revenue number for our privacy). As you can see, there are no numbers after 6:00 AM.
We saw this same effect yesterday (about 8-10 hour lag), and the following day the overview report seemed to fix itself (catch up with all of the aggregated data).
Now, what's more interesting, is that if we either A) Add a "Secondary Dimension" or B) use a "Custom Report", we can see all our data near real-time. For example, if I switch into the Ecommerce > Sales Performance report, then add a Secondary Dimension of "Hour of Day", I can see all my data through 2 PM today (about a 2 hour lag as it is now 4:22 pm as I am writing this)
[
Note that to replicate this I sorted the "Hour by day" column by descending order (showing most recent first.)
Our questions are:
(1) Does anyone know why searching by Secondary Dimension or Custom Report shows us the data in more real-time than just looking at the overview report?
(2) Can anyone else confirm that what used to be a 2-3 hour delay now appears as if it is a 8-12 hour delay, starting on or around March 14th (possibly a few days earlier, this is the first day we can remember seeing this effect)
We are using Universal Analytics (with Enhanced E-commerce) implemented via the newer analytics.js. We are NOT using the older ga.js (we moved away from that about a year ago.)
We are not a GA 360 customer, just a regular free account.
From Google Analytics Help Center article.
Processing latency is 24-48 hours. Standard accounts that send more than 200,000 sessions per day to Analytics will result in the reports being refreshed only once a day. This can delay updates to reports and metrics for up to two days. To restore intra-day processing, reduce the number of sessions your account sends to < 200,000 per day. For Analytics 360 accounts, this limit is extended to 2 billion hits per month.
What it means is that for Standard accounts up to 48h delay is normal, if you have more data it can take more if you have less data it can be faster.
Regarding your observation that certain reports load faster than others this is linked to the design of Google Analytics Backends. Google will generate pre-aggregated tables with common reports to speed up consult and that sometimes can takes longer to process. Other non-common reports can't be answered by aggregated reports so it can be responded by a different backend that already has fresher data. So it is considered normal to see different levels of freshness in different reports.
Google Analytics 360 has fresher data of course.
This other table from the HC article highlights some of the differences and has more info.
Background:
I have a Google Analytics account using which I am tracking user activity for web and mobile app. After logging into your account and choosing the web property and the corresponding view, you generally see a dashboard with quick stats like Pageviews, Users, Sessions, Pages/Sessions, Avg. Session Duration, Bounce Rate and percentage of new sessions. You can change the time period (from the top right area of the Dashboard) to get the same stats for that period.
Problem:
Last week, I was interested in the three main stats: Page views, Users and Sessions for a particular day - say, day A. The dashboard showed the following stats:
Pageviews - 1,660,137
Users - 496,068
Sessions - 983,549
This report was based on 100% of sessions.
I go back to the dashboard TODAY and check the same stats for the same day A. Here's what I saw:
Pageviews - 1,660,137
Users - 511,071
Sessions - 1,005,517
This report is also based on 100% of sessions.
Nothing was changed in the tracking code for the web and mobile app. Could someone explain why I have this difference in the stats? Is this normal?
They need some time to update the system, otherwise their system would overwhelm
When you first create a profile it can take up to 48 -72 hours for it to start showing data.
After that time data will appear instantly in the Real-time reports.
Standard reports take longer to finish processing. You need to remember the amount of data that is being processed. Some of the data may appear in the standard reports after a few hours. The numbers have not completed processing for at least 24 hours, so anything you look at then will not be accurate.
When checking Google Analytics never look at todays or yesterdays numbers in the standards reports, if you want accurate information. Things get even more confusing when you consider time zones. When exactly is it yesterday? I have noticed numbers changing as far back as 48 hours. But Google Says in there documentation 24 hours. I am looking for the link in the documentation will post it when I find it.
Found it: Data Limits
Data processing latency
Processing latency is 24-48 hours. Standard accounts that send more
than 200,000 sessions per day to Google Analytics will result in the
reports being refreshed only once a day. This can delay updates to
reports and metrics for up to two days. To restore intra-day
processing, reduce the number of sessions you send to < 200,000 per
day. For Premium accounts, this limit is extended to 2 billion hits
per month.
So try doing the same thing again today but check your last day being Monday. When you check again next week the numbers should be correct.
I've been using a SSIS Integration component to download data from Google Analytics in order to keep an historical view of some websites and track the evolution of them. Basically the metrics we track are Visits (now Sessions) and Visitros (now Users), and the dimensions are Year and Month. However, today I noticed that the data I downloaded for july had a variation on the Users metric. I heard that google analytics uses an estimation method to "calculate" some (if not all) of their metrics, could it be that after that they "adjust" the data with more acurate information? If so, is this mentioned in the documentation? (a link would be highly appreciated) Since the users are complaining that we are not delivering the real GA Data. I tried looked on the Google analytics documentation page with no luck.
Thanks for your time.
PS: Sorry for my english, it isnĀ“t my native language
If you are using the standard version of Google Analytics (you'll know if you are paying $150k for premium), data is sampled depending on volume. Have a read of this article can-you-trust-your-google-analytics-data
I have seen very slightly differing results being returned if you repeatedly call the api with the same historical parameters repeatedly. In my case the figures only differed by 1-2 over a daily set of several thousand, but nevertheless it differed.
If you want to guarantee your results, consider upgrading to premium
Sampling could be an issue if what you are requesting is over 50,000 rows for the time period you are requesting. To avoid it you can download more often, such as daily.
But I think your issue is that there is a processing time for Google Analytics - if you are downloading at 3 am on the 1st it is probable that the processing for the previous day has not finished.
Google Analytics Premium SLA is for 4 hour data freshness, so even that would have trouble. Pragmatically you should allow 24 hours before you download data for the previous day, 48 hours for e-commerce data.
Thirdly make sure it is not Unique Visitors you are requesting, as this is dependent on the time period you are requesting.