using the google analytics api to make most popular pages widgets for your website
DESCRIPTION
Using the Google Analytics API to create a most popular pages widget for your website or blog using the Google Analytics API. I'll demonstrate a custom report in Google Analytics, then show how to automate the same using Perl and the Google Analytics API to create an RSS feed of the top 10 stories from my blog — which I then incorporate into the siderail of my blog using a WordPress RSS widget. Here's the link to code in GitHub: http://bitly.com/ga-api2mpp?slideshareTRANSCRIPT
Using the Google Analytics APIto make MPP widgets for your website.
HealYourChurchWebsite.com@DeanPeters
Using the Google Analytics API ...
… to make most popular pages
widgets for your website.
by
@DeanPeters
HealYourChurchWebSite.com
Slides: http://slidesha.re/gaapi2mpp
Code: http://bitly.com/ga-api2mpp
Using the Google Analytics APIto make MPP widgets for your website.
HealYourChurchWebsite.com@DeanPeters
Intro
Who am I?
I'm the artist+geek linchpin Seth Godin warned you about.
What do I do?
I manage one of the Support Development Teams at
McClatchy Interactive.
Why am I doing this presentation?
I'm a self-admitted analytics and social media API junkie
Using the Google Analytics APIto make MPP widgets for your website.
HealYourChurchWebsite.com@DeanPeters
Some funs stuff I've done
FaceBook Like Button
Wrote a popular Facebook like button plugin for WordPress
Heal Your Church Website
Where I blog about my usability & API addictions
Son of Web Pages that Suck
I was a contributing author to that 2002 classic
Using the Google Analytics APIto make MPP widgets for your website.
HealYourChurchWebsite.com@DeanPeters
Most Popular Pages Widget
What is it?
It's usually a box on the side rail that list linked titles to the
most read stories on a website or blog
How popular is it?
You often see this widget on news media sites
Can we see some examples?
Sure
Using the Google Analytics APIto make MPP widgets for your website.
HealYourChurchWebsite.com@DeanPeters
Bradenton Herald
Using the Google Analytics APIto make MPP widgets for your website.
HealYourChurchWebsite.com@DeanPeters
USA Today
Using the Google Analytics APIto make MPP widgets for your website.
HealYourChurchWebsite.com@DeanPeters
Lexington Herald-Leader
Using the Google Analytics APIto make MPP widgets for your website.
HealYourChurchWebsite.com@DeanPeters
Most Popular Pages
Where do they get the data?
From sources such as Google Analytics & Omniture
Can I do this with my website or Blog?
Sure
Using the Google Analytics APIto make MPP widgets for your website.
HealYourChurchWebsite.com@DeanPeters
What you'll need
A Website or Blog
For today's example, we'll use WordPress
An Analytics Service with an API
For today's example, we'll use Google Analytics
A programming language
For today's example, we'll use Perl
Using the Google Analytics APIto make MPP widgets for your website.
HealYourChurchWebsite.com@DeanPeters
Google Analytics Dashboard
Standard Reporting How to filter your popular pages via GA's standard reports
Using the Google Analytics APIto make MPP widgets for your website.
HealYourChurchWebsite.com@DeanPeters
Google Analytics Dashboard Custom Reporting
How to create a custom report
Using the Google Analytics APIto make MPP widgets for your website.
HealYourChurchWebsite.com@DeanPeters
Why You Need an API
Exporting from the Dashboard ...
… is a process that is tedious and unsustainable
Using an API ...
… allows you to automate this process
Using a Programming Language ...
… let's you fine-tune the data and reports you need
Using the Google Analytics APIto make MPP widgets for your website.
HealYourChurchWebsite.com@DeanPeters
What is the Google API?
One of many API web services ...
… found at http://code.google.com/more/
What does it provide?
Programmatic access to Google Analytics report data &
statistics derived from the data collected on your site,
organized as dimensions and metrics.
Using the Google Analytics APIto make MPP widgets for your website.
HealYourChurchWebsite.com@DeanPeters
Dimensions & Metrics
You've already seen these ...
… in custom & standard reports
Dimensions ...
… are the rows of data
Metrics ...
… are columns of data in the rows
Using the Google Analytics APIto make MPP widgets for your website.
HealYourChurchWebsite.com@DeanPeters
Accessing the API
You'll need to be authenticated ...
… in this case we'll use a gmail id & password
You'll need the Profile ID ...
… this is NOT the UA key
You'll need to filter the data ...
… using our old friends dimensions & metrics
Using the Google Analytics APIto make MPP widgets for your website.
HealYourChurchWebsite.com@DeanPeters
Coding for the API
You'll need to be authenticated ...
… with Perl, we'll use Net::Google::AuthSub
You'll need to talk via your Profile ID ...
… with Perl, we'll use Net::Google::Analytics
You'll need to output the data ...
… with Perl, we'll use XML::FeedPP
Using the Google Analytics APIto make MPP widgets for your website.
HealYourChurchWebsite.com@DeanPeters
ga-api2mpp.pl
This is where I show you some code
Using the Google Analytics APIto make MPP widgets for your website.
HealYourChurchWebsite.com@DeanPeters
Limitations of the API
Authentication is often a hurdle ...
… for Google Analytics, investigate using OAuth
Be careful of quanity ...
… don't get penalized for asking for everything all the time
Don't expect miracles ...
… the quality of the data you pull is directly proportional to
to how well you've setup & configured Google Analytics
Using the Google Analytics APIto make MPP widgets for your website.
HealYourChurchWebsite.com@DeanPeters
Implementing the Code Crontab the program
* */12 * * * perl ga-api2mpp.pl username\@gmail.com password
Add the output to your blog ... … here's where I show you some WordPress widgetry
Using the Google Analytics APIto make MPP widgets for your website.
HealYourChurchWebsite.com@DeanPeters
Voilà
This is where I show you some results
Using the Google Analytics APIto make MPP widgets for your website.
HealYourChurchWebsite.com@DeanPeters
Take-Aways
Coding is 'easy-enough' ...
… if you let other libraries & modules do the heavy-lifting
Garbage-in/Garbage-out ...
… the API can only 'pull' what data your actively tracking
Have fun & explore...
… you'll be amazed at how many different and cool ways
you can slice-n-dice your data in a coder's context
Using the Google Analytics APIto make MPP widgets for your website.
HealYourChurchWebsite.com@DeanPeters
Questions & Answers
On creating a Most Popular Pages widget for your website using the Google API.
by
@DeanPeters
HealYourChurchWebsite.com
Slides:http://slidesha.re/gaapi2mpp
Code: http://bitly.com/ga-api2mpp