1. digmato.com | @appeltauer
Start faster with
Google Analytics API
Roman Appeltauer
Web Analytics consultant
digmato.com
Prague September 12th 2015
2. digmato.com | @appeltauer
Automation
Wikipedia:
The biggest benefit of
automation is that it saves
labor, however, it is also used to
save energy and materials and to
improve quality, accuracy and
precision.
3. digmato.com | @appeltauer
Automation in web Analytics
• Save time on doing basic stuff again and again and again and...
• Analysts should do things that actually add value
• Make less errors (you would be surprised)
• Check more (facts|often|details) than you would manually
5. digmato.com | @appeltauer
Choose development method
• Choose API method (https://developers.google.com/identity/protocols/OAuth2)
• JavaScript - great for simple dashboards (Embed API)
• Web Server app - more complex, may work while you are offline
• Or consider ready solutions
• GA Spreadsheet Add-on, or in library
• Find an open source app
6. digmato.com | @appeltauer
Register your Project
• Register and set up Project (https://console.developers.google.com/project)
• Each Project has it's own Credentials
Choose OAuth 2.0 client ID
• Activate Google Analytics API
7. digmato.com | @appeltauer
Download Google API library
• Choose your preferred technology
• Some libraries are in Beta, but work well ;-)
• The library contains all availale APIs, not just Google Analytics
• Start with bundled examples and make very simple app in minutes
• https://developers.google.com/discovery/libraries
8. digmato.com | @appeltauer
Hello Analytics API: First steps
• Start on Core Reporting API guides page
• Find your technology e.g. PHP Quickstarts
• You'll get guided through example code
• Don't forget to paste Project Credentials (as shown before)
10. digmato.com | @appeltauer
Who is your app for?
• You'll save a lot of time if your app is for closed group of users
• 80% of DIGMATO.com code deals with specifics
• Account selectors - tailor made app may hardcode many custom settings
• Insufficient user permissions - you know what rights your app needs
• Visualization of results - smart tables, colors, progress bars
• Validation of finished user request - reality checks, finish on back-end
• Handling Google Analytics API error responses - retry, log, notify user if needed
11. digmato.com | @appeltauer
Limitations
• 50 000 calls a day - ok for most apps
• 500 management writes a day
- bad e.g. for Referral SPAM tools
• Rate limit up to 10 hits per second read
(1 hit/s write)
• Quota usage monitoring in Developers
Console
13. digmato.com | @appeltauer
Never automate what you can't do manually
• The app will break - you just don't know when
(API changes, server and browser updates)
• You might have no backup solution if the app breaks
• You need to be able to improvise when data breaks
(wrong UTM params, change in URLs, bug in tracking code)
• You'll need to drill down manually when numbers get interesting
• It will take too much time and you'll never be sure if it works.
14. digmato.com | @appeltauer
Don't reinvent the wheel
• Tailor made functionality saves most of the time
• Common features pay back when used very often (or by many people)
• Ready apps are great for most use-cases and first steps
• Don't duplicate Google Analytics features without adding value
15. digmato.com | @appeltauer
Don't create app you won't need
• App for one-time use is wasting of your time
• Prioritize features you'll use often enough
• Likely there's an app for that and costs much less than your time
16. digmato.com | @appeltauer
Create apps for others
• Give marketers the data they need - it's worth it!
• Easy-to-get data lead to more actionable insights
• It's more fun to make life easier for others