I finally tried to use Google Analytics API to generate a report which in a format I prefer to read. It’s simple but it has everything I am interested.
I set up a cron job at 0:30 AM PST for generating the daily report. I want to read the full-day-data, not the real-time data. There are still some elements I may add later, it’s just my first try.
When you run the sample script of GData API, there are three ways to authorize the code to access the data, ClientLogin, AuthSub, and OAuth. The latter two require website and/or domain. Though the demo also provides a demo website for receiving the credentials for you, but I don’t feel comfortable about the middle man. My script just grabs three command-line arguments, they are in order, your Google email address, password, and the table ID (see The script section below).
Contents
1 What’s in report
The generated report has four parts, General, Referrals, Keywords, and Top content.
1.1 General section
The general section shows a bar chart of visits from the last 60 days at first. A table of a few metrics follows, also provides the change from the day before yesterday to yesterday. (In PST timezone)
If you look closer, there are two changes are 99999.99%. It’s not they are really that value, you will read that percentage when there is no enough data to calculate change or when the change is a value divided by zero.
The last part of this section shows another bar chart of each medium percentage of all visits and pageviews.
1.2 Referrals, keywords, and top content sections
The three sections have similar presentation. They show the visits count, the referrer URL, and the landing page or source (if it’s top content).
2 The script
The script my-ga-report.py was started with the GData demo samples, but there isn’t much left from them.
2.1 Table ID
Table ID is actually your Profile ID with prefix "ga:", you can find Profile ID in Profile Settings page. For example, the Table ID of Profile ID 1234567 is ga:1234567.
The reason of having a ID different than UA number is you may have additional profiles which uses filters. They are associated to the same UA but the represented data is different because of the filters.
3 .
I am currently only interested in those data. It’s not hard to get these on Google Analytics, but it requires more clicks. I think you can save predefined reports, but, to be honest, I feel Google Analytics has grown too complicated to use. Tons of feature that I have no idea what they mean, not to mention it gets confusing when you operate on the interface for the first time.
I think unless you are someone who needs to give a report in a meeting or you are $EO person, you don’t really care those advanced stuff as I don’t.
what is the table id?
ReplyDelete"You can use account_feed_demo.py for [getting] the table ID, it's not the UA number."
ReplyDelete